asm-offsets_64.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Generate definitions needed by assembly language modules.
  3. * This code generates raw asm output which is post-processed to extract
  4. * and format the required data.
  5. */
  6. #include <linux/crypto.h>
  7. #include <linux/sched.h>
  8. #include <linux/stddef.h>
  9. #include <linux/errno.h>
  10. #include <linux/hardirq.h>
  11. #include <linux/suspend.h>
  12. #include <linux/kbuild.h>
  13. #include <asm/pda.h>
  14. #include <asm/processor.h>
  15. #include <asm/segment.h>
  16. #include <asm/thread_info.h>
  17. #include <asm/ia32.h>
  18. #include <asm/bootparam.h>
  19. #define __NO_STUBS 1
  20. #undef __SYSCALL
  21. #undef _ASM_X86_64_UNISTD_H_
  22. #define __SYSCALL(nr, sym) [nr] = 1,
  23. static char syscalls[] = {
  24. #include <asm/unistd.h>
  25. };
  26. int main(void)
  27. {
  28. #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
  29. ENTRY(state);
  30. ENTRY(flags);
  31. ENTRY(pid);
  32. BLANK();
  33. #undef ENTRY
  34. #define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
  35. ENTRY(flags);
  36. ENTRY(addr_limit);
  37. ENTRY(preempt_count);
  38. ENTRY(status);
  39. #ifdef CONFIG_IA32_EMULATION
  40. ENTRY(sysenter_return);
  41. #endif
  42. BLANK();
  43. #undef ENTRY
  44. #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
  45. ENTRY(kernelstack);
  46. ENTRY(oldrsp);
  47. ENTRY(pcurrent);
  48. ENTRY(irqcount);
  49. ENTRY(cpunumber);
  50. ENTRY(irqstackptr);
  51. ENTRY(data_offset);
  52. BLANK();
  53. #undef ENTRY
  54. #ifdef CONFIG_PARAVIRT
  55. BLANK();
  56. OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
  57. OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
  58. OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
  59. OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
  60. OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
  61. OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
  62. OFFSET(PV_CPU_irq_enable_syscall_ret, pv_cpu_ops, irq_enable_syscall_ret);
  63. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  64. OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
  65. #endif
  66. #ifdef CONFIG_IA32_EMULATION
  67. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  68. ENTRY(ax);
  69. ENTRY(bx);
  70. ENTRY(cx);
  71. ENTRY(dx);
  72. ENTRY(si);
  73. ENTRY(di);
  74. ENTRY(bp);
  75. ENTRY(sp);
  76. ENTRY(ip);
  77. BLANK();
  78. #undef ENTRY
  79. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  80. offsetof (struct rt_sigframe32, uc.uc_mcontext));
  81. BLANK();
  82. #endif
  83. DEFINE(pbe_address, offsetof(struct pbe, address));
  84. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  85. DEFINE(pbe_next, offsetof(struct pbe, next));
  86. BLANK();
  87. #define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
  88. ENTRY(bx);
  89. ENTRY(bx);
  90. ENTRY(cx);
  91. ENTRY(dx);
  92. ENTRY(sp);
  93. ENTRY(bp);
  94. ENTRY(si);
  95. ENTRY(di);
  96. ENTRY(r8);
  97. ENTRY(r9);
  98. ENTRY(r10);
  99. ENTRY(r11);
  100. ENTRY(r12);
  101. ENTRY(r13);
  102. ENTRY(r14);
  103. ENTRY(r15);
  104. ENTRY(flags);
  105. BLANK();
  106. #undef ENTRY
  107. #define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
  108. ENTRY(cr0);
  109. ENTRY(cr2);
  110. ENTRY(cr3);
  111. ENTRY(cr4);
  112. ENTRY(cr8);
  113. BLANK();
  114. #undef ENTRY
  115. DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
  116. BLANK();
  117. DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
  118. BLANK();
  119. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  120. BLANK();
  121. OFFSET(BP_scratch, boot_params, scratch);
  122. OFFSET(BP_loadflags, boot_params, hdr.loadflags);
  123. OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
  124. OFFSET(BP_version, boot_params, hdr.version);
  125. return 0;
  126. }