asm-offsets_64.c 3.7 KB

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