asm-offsets_32.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * Generate definitions needed by assembly language modules.
  3. * This code generates raw asm output which is post-processed
  4. * to extract and format the required data.
  5. */
  6. #include <linux/crypto.h>
  7. #include <linux/sched.h>
  8. #include <linux/signal.h>
  9. #include <linux/personality.h>
  10. #include <linux/suspend.h>
  11. #include <linux/kbuild.h>
  12. #include <asm/ucontext.h>
  13. #include <asm/sigframe.h>
  14. #include <asm/pgtable.h>
  15. #include <asm/fixmap.h>
  16. #include <asm/processor.h>
  17. #include <asm/thread_info.h>
  18. #include <asm/bootparam.h>
  19. #include <asm/elf.h>
  20. #include <asm/suspend.h>
  21. #include <xen/interface/xen.h>
  22. #include <linux/lguest.h>
  23. #include "../../../drivers/lguest/lg.h"
  24. /* workaround for a warning with -Wmissing-prototypes */
  25. void foo(void);
  26. void foo(void)
  27. {
  28. OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
  29. OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
  30. OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
  31. OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
  32. OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
  33. OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
  34. OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
  35. OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
  36. OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
  37. BLANK();
  38. OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
  39. OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
  40. OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
  41. OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
  42. OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
  43. OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
  44. OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
  45. OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
  46. BLANK();
  47. OFFSET(TI_task, thread_info, task);
  48. OFFSET(TI_exec_domain, thread_info, exec_domain);
  49. OFFSET(TI_flags, thread_info, flags);
  50. OFFSET(TI_status, thread_info, status);
  51. OFFSET(TI_preempt_count, thread_info, preempt_count);
  52. OFFSET(TI_addr_limit, thread_info, addr_limit);
  53. OFFSET(TI_restart_block, thread_info, restart_block);
  54. OFFSET(TI_sysenter_return, thread_info, sysenter_return);
  55. OFFSET(TI_cpu, thread_info, cpu);
  56. BLANK();
  57. OFFSET(GDS_size, desc_ptr, size);
  58. OFFSET(GDS_address, desc_ptr, address);
  59. BLANK();
  60. OFFSET(PT_EBX, pt_regs, bx);
  61. OFFSET(PT_ECX, pt_regs, cx);
  62. OFFSET(PT_EDX, pt_regs, dx);
  63. OFFSET(PT_ESI, pt_regs, si);
  64. OFFSET(PT_EDI, pt_regs, di);
  65. OFFSET(PT_EBP, pt_regs, bp);
  66. OFFSET(PT_EAX, pt_regs, ax);
  67. OFFSET(PT_DS, pt_regs, ds);
  68. OFFSET(PT_ES, pt_regs, es);
  69. OFFSET(PT_FS, pt_regs, fs);
  70. OFFSET(PT_GS, pt_regs, gs);
  71. OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
  72. OFFSET(PT_EIP, pt_regs, ip);
  73. OFFSET(PT_CS, pt_regs, cs);
  74. OFFSET(PT_EFLAGS, pt_regs, flags);
  75. OFFSET(PT_OLDESP, pt_regs, sp);
  76. OFFSET(PT_OLDSS, pt_regs, ss);
  77. BLANK();
  78. OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
  79. OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
  80. BLANK();
  81. OFFSET(pbe_address, pbe, address);
  82. OFFSET(pbe_orig_address, pbe, orig_address);
  83. OFFSET(pbe_next, pbe, next);
  84. /* Offset from the sysenter stack to tss.sp0 */
  85. DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
  86. sizeof(struct tss_struct));
  87. DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
  88. DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT);
  89. DEFINE(PTRS_PER_PTE, PTRS_PER_PTE);
  90. DEFINE(PTRS_PER_PMD, PTRS_PER_PMD);
  91. DEFINE(PTRS_PER_PGD, PTRS_PER_PGD);
  92. OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
  93. #ifdef CONFIG_PARAVIRT
  94. BLANK();
  95. OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
  96. OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
  97. OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
  98. OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
  99. OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
  100. OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
  101. OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
  102. OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
  103. #endif
  104. #ifdef CONFIG_XEN
  105. BLANK();
  106. OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
  107. OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
  108. #endif
  109. #if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
  110. BLANK();
  111. OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
  112. OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
  113. BLANK();
  114. OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
  115. OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
  116. OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
  117. OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
  118. OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
  119. OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
  120. OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
  121. OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
  122. OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
  123. OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
  124. #endif
  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. }