asm-offsets_32.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include <asm/ucontext.h>
  2. #include <linux/lguest.h>
  3. #include "../../../drivers/lguest/lg.h"
  4. /* workaround for a warning with -Wmissing-prototypes */
  5. void foo(void);
  6. void foo(void)
  7. {
  8. OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
  9. OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
  10. OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
  11. OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
  12. OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
  13. OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
  14. OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
  15. OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
  16. OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
  17. BLANK();
  18. OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
  19. OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
  20. OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
  21. OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
  22. OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
  23. OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
  24. OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
  25. OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
  26. BLANK();
  27. OFFSET(TI_sysenter_return, thread_info, sysenter_return);
  28. OFFSET(TI_cpu, thread_info, cpu);
  29. BLANK();
  30. OFFSET(PT_EBX, pt_regs, bx);
  31. OFFSET(PT_ECX, pt_regs, cx);
  32. OFFSET(PT_EDX, pt_regs, dx);
  33. OFFSET(PT_ESI, pt_regs, si);
  34. OFFSET(PT_EDI, pt_regs, di);
  35. OFFSET(PT_EBP, pt_regs, bp);
  36. OFFSET(PT_EAX, pt_regs, ax);
  37. OFFSET(PT_DS, pt_regs, ds);
  38. OFFSET(PT_ES, pt_regs, es);
  39. OFFSET(PT_FS, pt_regs, fs);
  40. OFFSET(PT_GS, pt_regs, gs);
  41. OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
  42. OFFSET(PT_EIP, pt_regs, ip);
  43. OFFSET(PT_CS, pt_regs, cs);
  44. OFFSET(PT_EFLAGS, pt_regs, flags);
  45. OFFSET(PT_OLDESP, pt_regs, sp);
  46. OFFSET(PT_OLDSS, pt_regs, ss);
  47. BLANK();
  48. OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
  49. BLANK();
  50. /* Offset from the sysenter stack to tss.sp0 */
  51. DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
  52. sizeof(struct tss_struct));
  53. #if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
  54. BLANK();
  55. OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
  56. OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
  57. OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
  58. BLANK();
  59. OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
  60. OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
  61. OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
  62. OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
  63. OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
  64. OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
  65. OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
  66. OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
  67. OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
  68. OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
  69. #endif
  70. }