asm-offsets_64.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
  29. ENTRY(bx);
  30. ENTRY(cx);
  31. ENTRY(dx);
  32. ENTRY(sp);
  33. ENTRY(bp);
  34. ENTRY(si);
  35. ENTRY(di);
  36. ENTRY(r8);
  37. ENTRY(r9);
  38. ENTRY(r10);
  39. ENTRY(r11);
  40. ENTRY(r12);
  41. ENTRY(r13);
  42. ENTRY(r14);
  43. ENTRY(r15);
  44. ENTRY(flags);
  45. BLANK();
  46. #undef ENTRY
  47. #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
  48. ENTRY(cr0);
  49. ENTRY(cr2);
  50. ENTRY(cr3);
  51. ENTRY(cr4);
  52. ENTRY(cr8);
  53. ENTRY(gdt_desc);
  54. BLANK();
  55. #undef ENTRY
  56. OFFSET(TSS_ist, tss_struct, x86_tss.ist);
  57. OFFSET(TSS_sp0, tss_struct, x86_tss.sp0);
  58. BLANK();
  59. DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
  60. DEFINE(NR_syscalls, sizeof(syscalls_64));
  61. DEFINE(__NR_syscall_compat_max, sizeof(syscalls_ia32) - 1);
  62. DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
  63. return 0;
  64. }