asm-offsets_64.c 3.7 KB

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