asm-offsets_64.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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/processor.h>
  14. #include <asm/segment.h>
  15. #include <asm/thread_info.h>
  16. #include <asm/ia32.h>
  17. #include <asm/bootparam.h>
  18. #include <asm/suspend.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. #ifdef CONFIG_PARAVIRT
  47. BLANK();
  48. OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
  49. OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
  50. OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
  51. OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
  52. OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
  53. OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
  54. OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
  55. OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
  56. OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
  57. OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
  58. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  59. OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
  60. #endif
  61. #ifdef CONFIG_IA32_EMULATION
  62. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  63. ENTRY(ax);
  64. ENTRY(bx);
  65. ENTRY(cx);
  66. ENTRY(dx);
  67. ENTRY(si);
  68. ENTRY(di);
  69. ENTRY(bp);
  70. ENTRY(sp);
  71. ENTRY(ip);
  72. BLANK();
  73. #undef ENTRY
  74. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  75. offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
  76. BLANK();
  77. #endif
  78. DEFINE(pbe_address, offsetof(struct pbe, address));
  79. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  80. DEFINE(pbe_next, offsetof(struct pbe, next));
  81. BLANK();
  82. #define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
  83. ENTRY(bx);
  84. ENTRY(bx);
  85. ENTRY(cx);
  86. ENTRY(dx);
  87. ENTRY(sp);
  88. ENTRY(bp);
  89. ENTRY(si);
  90. ENTRY(di);
  91. ENTRY(r8);
  92. ENTRY(r9);
  93. ENTRY(r10);
  94. ENTRY(r11);
  95. ENTRY(r12);
  96. ENTRY(r13);
  97. ENTRY(r14);
  98. ENTRY(r15);
  99. ENTRY(flags);
  100. BLANK();
  101. #undef ENTRY
  102. #define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
  103. ENTRY(cr0);
  104. ENTRY(cr2);
  105. ENTRY(cr3);
  106. ENTRY(cr4);
  107. ENTRY(cr8);
  108. BLANK();
  109. #undef ENTRY
  110. DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
  111. BLANK();
  112. DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
  113. BLANK();
  114. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  115. BLANK();
  116. OFFSET(BP_scratch, boot_params, scratch);
  117. OFFSET(BP_loadflags, boot_params, hdr.loadflags);
  118. OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
  119. OFFSET(BP_version, boot_params, hdr.version);
  120. BLANK();
  121. DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
  122. #ifdef CONFIG_XEN
  123. BLANK();
  124. OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
  125. OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
  126. #undef ENTRY
  127. #endif
  128. return 0;
  129. }