asm-offsets_64.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. #define COMPILE_OFFSETS
  7. #include <linux/crypto.h>
  8. #include <linux/sched.h>
  9. #include <linux/stddef.h>
  10. #include <linux/errno.h>
  11. #include <linux/hardirq.h>
  12. #include <linux/suspend.h>
  13. #include <linux/kbuild.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. #include <asm/suspend.h>
  20. #include <xen/interface/xen.h>
  21. #include <asm/sigframe.h>
  22. #define __NO_STUBS 1
  23. #undef __SYSCALL
  24. #undef _ASM_X86_UNISTD_64_H
  25. #define __SYSCALL(nr, sym) [nr] = 1,
  26. static char syscalls[] = {
  27. #include <asm/unistd.h>
  28. };
  29. int main(void)
  30. {
  31. #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
  32. ENTRY(state);
  33. ENTRY(flags);
  34. ENTRY(pid);
  35. BLANK();
  36. #undef ENTRY
  37. #define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
  38. ENTRY(flags);
  39. ENTRY(addr_limit);
  40. ENTRY(preempt_count);
  41. ENTRY(status);
  42. #ifdef CONFIG_IA32_EMULATION
  43. ENTRY(sysenter_return);
  44. #endif
  45. BLANK();
  46. #undef ENTRY
  47. #ifdef CONFIG_PARAVIRT
  48. BLANK();
  49. OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
  50. OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
  51. OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
  52. OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
  53. OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
  54. OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
  55. OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
  56. OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
  57. OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
  58. OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
  59. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  60. OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
  61. #endif
  62. #ifdef CONFIG_IA32_EMULATION
  63. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  64. ENTRY(ax);
  65. ENTRY(bx);
  66. ENTRY(cx);
  67. ENTRY(dx);
  68. ENTRY(si);
  69. ENTRY(di);
  70. ENTRY(bp);
  71. ENTRY(sp);
  72. ENTRY(ip);
  73. BLANK();
  74. #undef ENTRY
  75. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  76. offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
  77. BLANK();
  78. #endif
  79. DEFINE(pbe_address, offsetof(struct pbe, address));
  80. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  81. DEFINE(pbe_next, offsetof(struct pbe, next));
  82. BLANK();
  83. #define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
  84. ENTRY(bx);
  85. ENTRY(bx);
  86. ENTRY(cx);
  87. ENTRY(dx);
  88. ENTRY(sp);
  89. ENTRY(bp);
  90. ENTRY(si);
  91. ENTRY(di);
  92. ENTRY(r8);
  93. ENTRY(r9);
  94. ENTRY(r10);
  95. ENTRY(r11);
  96. ENTRY(r12);
  97. ENTRY(r13);
  98. ENTRY(r14);
  99. ENTRY(r15);
  100. ENTRY(flags);
  101. BLANK();
  102. #undef ENTRY
  103. #define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
  104. ENTRY(cr0);
  105. ENTRY(cr2);
  106. ENTRY(cr3);
  107. ENTRY(cr4);
  108. ENTRY(cr8);
  109. BLANK();
  110. #undef ENTRY
  111. DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
  112. BLANK();
  113. DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
  114. BLANK();
  115. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  116. BLANK();
  117. OFFSET(BP_scratch, boot_params, scratch);
  118. OFFSET(BP_loadflags, boot_params, hdr.loadflags);
  119. OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
  120. OFFSET(BP_version, boot_params, hdr.version);
  121. OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment);
  122. BLANK();
  123. DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
  124. #ifdef CONFIG_XEN
  125. BLANK();
  126. OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
  127. OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
  128. #undef ENTRY
  129. #endif
  130. return 0;
  131. }