asm-offsets_64.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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(TI_ ## 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_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
  62. OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
  63. OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
  64. OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
  65. OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
  66. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  67. OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
  68. #endif
  69. #ifdef CONFIG_IA32_EMULATION
  70. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  71. ENTRY(ax);
  72. ENTRY(bx);
  73. ENTRY(cx);
  74. ENTRY(dx);
  75. ENTRY(si);
  76. ENTRY(di);
  77. ENTRY(bp);
  78. ENTRY(sp);
  79. ENTRY(ip);
  80. BLANK();
  81. #undef ENTRY
  82. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  83. offsetof (struct rt_sigframe32, uc.uc_mcontext));
  84. BLANK();
  85. #endif
  86. DEFINE(pbe_address, offsetof(struct pbe, address));
  87. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  88. DEFINE(pbe_next, offsetof(struct pbe, next));
  89. BLANK();
  90. #define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
  91. ENTRY(bx);
  92. ENTRY(bx);
  93. ENTRY(cx);
  94. ENTRY(dx);
  95. ENTRY(sp);
  96. ENTRY(bp);
  97. ENTRY(si);
  98. ENTRY(di);
  99. ENTRY(r8);
  100. ENTRY(r9);
  101. ENTRY(r10);
  102. ENTRY(r11);
  103. ENTRY(r12);
  104. ENTRY(r13);
  105. ENTRY(r14);
  106. ENTRY(r15);
  107. ENTRY(flags);
  108. BLANK();
  109. #undef ENTRY
  110. #define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
  111. ENTRY(cr0);
  112. ENTRY(cr2);
  113. ENTRY(cr3);
  114. ENTRY(cr4);
  115. ENTRY(cr8);
  116. BLANK();
  117. #undef ENTRY
  118. DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
  119. BLANK();
  120. DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
  121. BLANK();
  122. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  123. BLANK();
  124. OFFSET(BP_scratch, boot_params, scratch);
  125. OFFSET(BP_loadflags, boot_params, hdr.loadflags);
  126. OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
  127. OFFSET(BP_version, boot_params, hdr.version);
  128. return 0;
  129. }