asm-offsets_64.c 1.5 KB

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