asm-offsets_32.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef __LINUX_KBUILD_H
  2. # error "Please do not build this file directly, build asm-offsets.c instead"
  3. #endif
  4. #include <asm/ucontext.h>
  5. #include <linux/lguest.h>
  6. #include "../../../drivers/lguest/lg.h"
  7. #define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
  8. static char syscalls[] = {
  9. #include <asm/syscalls_32.h>
  10. };
  11. /* workaround for a warning with -Wmissing-prototypes */
  12. void foo(void);
  13. void foo(void)
  14. {
  15. OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
  16. OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
  17. OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
  18. OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
  19. OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
  20. OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
  21. OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
  22. BLANK();
  23. OFFSET(PT_EBX, pt_regs, bx);
  24. OFFSET(PT_ECX, pt_regs, cx);
  25. OFFSET(PT_EDX, pt_regs, dx);
  26. OFFSET(PT_ESI, pt_regs, si);
  27. OFFSET(PT_EDI, pt_regs, di);
  28. OFFSET(PT_EBP, pt_regs, bp);
  29. OFFSET(PT_EAX, pt_regs, ax);
  30. OFFSET(PT_DS, pt_regs, ds);
  31. OFFSET(PT_ES, pt_regs, es);
  32. OFFSET(PT_FS, pt_regs, fs);
  33. OFFSET(PT_GS, pt_regs, gs);
  34. OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
  35. OFFSET(PT_EIP, pt_regs, ip);
  36. OFFSET(PT_CS, pt_regs, cs);
  37. OFFSET(PT_EFLAGS, pt_regs, flags);
  38. OFFSET(PT_OLDESP, pt_regs, sp);
  39. OFFSET(PT_OLDSS, pt_regs, ss);
  40. BLANK();
  41. OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
  42. BLANK();
  43. /* Offset from the sysenter stack to tss.sp0 */
  44. DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
  45. offsetofend(struct tss_struct, SYSENTER_stack));
  46. #if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
  47. BLANK();
  48. OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
  49. OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
  50. BLANK();
  51. OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
  52. OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
  53. OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
  54. OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
  55. OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
  56. OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
  57. OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
  58. OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
  59. OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
  60. OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
  61. #endif
  62. BLANK();
  63. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  64. DEFINE(NR_syscalls, sizeof(syscalls));
  65. }