asm-offsets_64.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #include <asm/ia32.h>
  2. #define __NO_STUBS 1
  3. #undef __SYSCALL
  4. #undef _ASM_X86_UNISTD_64_H
  5. #define __SYSCALL(nr, sym) [nr] = 1,
  6. static char syscalls[] = {
  7. #include <asm/unistd.h>
  8. };
  9. int main(void)
  10. {
  11. #ifdef CONFIG_PARAVIRT
  12. OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
  13. OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
  14. OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
  15. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  16. BLANK();
  17. #endif
  18. #ifdef CONFIG_IA32_EMULATION
  19. OFFSET(TI_sysenter_return, thread_info, sysenter_return);
  20. BLANK();
  21. #define ENTRY(entry) OFFSET(IA32_SIGCONTEXT_ ## entry, sigcontext_ia32, entry)
  22. ENTRY(ax);
  23. ENTRY(bx);
  24. ENTRY(cx);
  25. ENTRY(dx);
  26. ENTRY(si);
  27. ENTRY(di);
  28. ENTRY(bp);
  29. ENTRY(sp);
  30. ENTRY(ip);
  31. BLANK();
  32. #undef ENTRY
  33. OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);
  34. BLANK();
  35. #endif
  36. #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
  37. ENTRY(bx);
  38. ENTRY(bx);
  39. ENTRY(cx);
  40. ENTRY(dx);
  41. ENTRY(sp);
  42. ENTRY(bp);
  43. ENTRY(si);
  44. ENTRY(di);
  45. ENTRY(r8);
  46. ENTRY(r9);
  47. ENTRY(r10);
  48. ENTRY(r11);
  49. ENTRY(r12);
  50. ENTRY(r13);
  51. ENTRY(r14);
  52. ENTRY(r15);
  53. ENTRY(flags);
  54. BLANK();
  55. #undef ENTRY
  56. #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
  57. ENTRY(cr0);
  58. ENTRY(cr2);
  59. ENTRY(cr3);
  60. ENTRY(cr4);
  61. ENTRY(cr8);
  62. BLANK();
  63. #undef ENTRY
  64. OFFSET(TSS_ist, tss_struct, x86_tss.ist);
  65. BLANK();
  66. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  67. return 0;
  68. }