asm-offsets_64.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef __LINUX_KBUILD_H
  2. # error "Please do not build this file directly, build asm-offsets.c instead"
  3. #endif
  4. #include <asm/ia32.h>
  5. #define __SYSCALL_64(nr, sym, compat) [nr] = 1,
  6. #define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1,
  7. #ifdef CONFIG_X86_X32_ABI
  8. # define __SYSCALL_X32(nr, sym, compat) [nr] = 1,
  9. #else
  10. # define __SYSCALL_X32(nr, sym, compat) /* nothing */
  11. #endif
  12. static char syscalls_64[] = {
  13. #include <asm/syscalls_64.h>
  14. };
  15. #define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
  16. static char syscalls_ia32[] = {
  17. #include <asm/syscalls_32.h>
  18. };
  19. int main(void)
  20. {
  21. #ifdef CONFIG_PARAVIRT
  22. OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
  23. OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
  24. OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
  25. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  26. BLANK();
  27. #endif
  28. #ifdef CONFIG_IA32_EMULATION
  29. OFFSET(TI_sysenter_return, thread_info, sysenter_return);
  30. BLANK();
  31. #define ENTRY(entry) OFFSET(IA32_SIGCONTEXT_ ## entry, sigcontext_ia32, entry)
  32. ENTRY(ax);
  33. ENTRY(bx);
  34. ENTRY(cx);
  35. ENTRY(dx);
  36. ENTRY(si);
  37. ENTRY(di);
  38. ENTRY(bp);
  39. ENTRY(sp);
  40. ENTRY(ip);
  41. BLANK();
  42. #undef ENTRY
  43. OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);
  44. BLANK();
  45. #endif
  46. #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
  47. ENTRY(bx);
  48. ENTRY(cx);
  49. ENTRY(dx);
  50. ENTRY(sp);
  51. ENTRY(bp);
  52. ENTRY(si);
  53. ENTRY(di);
  54. ENTRY(r8);
  55. ENTRY(r9);
  56. ENTRY(r10);
  57. ENTRY(r11);
  58. ENTRY(r12);
  59. ENTRY(r13);
  60. ENTRY(r14);
  61. ENTRY(r15);
  62. ENTRY(flags);
  63. BLANK();
  64. #undef ENTRY
  65. #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
  66. ENTRY(cr0);
  67. ENTRY(cr2);
  68. ENTRY(cr3);
  69. ENTRY(cr4);
  70. ENTRY(cr8);
  71. ENTRY(gdt_desc);
  72. BLANK();
  73. #undef ENTRY
  74. OFFSET(TSS_ist, tss_struct, x86_tss.ist);
  75. OFFSET(TSS_sp0, tss_struct, x86_tss.sp0);
  76. BLANK();
  77. DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
  78. DEFINE(NR_syscalls, sizeof(syscalls_64));
  79. DEFINE(__NR_ia32_syscall_max, sizeof(syscalls_ia32) - 1);
  80. DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
  81. return 0;
  82. }