asm-offsets_32.c 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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, qual) [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_stepping, cpuinfo_x86, x86_stepping);
  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. /* Offset from cpu_tss to SYSENTER_stack */
  47. OFFSET(CPU_TSS_SYSENTER_stack, tss_struct, SYSENTER_stack);
  48. /* Size of SYSENTER_stack */
  49. DEFINE(SIZEOF_SYSENTER_stack, sizeof(((struct tss_struct *)0)->SYSENTER_stack));
  50. #ifdef CONFIG_CC_STACKPROTECTOR
  51. BLANK();
  52. OFFSET(stack_canary_offset, stack_canary, canary);
  53. #endif
  54. #if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
  55. BLANK();
  56. OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
  57. OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
  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. BLANK();
  71. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  72. DEFINE(NR_syscalls, sizeof(syscalls));
  73. }