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, qual) [nr] = 1,
  6. static char syscalls_64[] = {
  7. #include <asm/syscalls_64.h>
  8. };
  9. #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
  10. static char syscalls_ia32[] = {
  11. #include <asm/syscalls_32.h>
  12. };
  13. int main(void)
  14. {
  15. #ifdef CONFIG_PARAVIRT
  16. OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
  17. OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
  18. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  19. BLANK();
  20. #endif
  21. #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
  22. ENTRY(bx);
  23. ENTRY(cx);
  24. ENTRY(dx);
  25. ENTRY(sp);
  26. ENTRY(bp);
  27. ENTRY(si);
  28. ENTRY(di);
  29. ENTRY(r8);
  30. ENTRY(r9);
  31. ENTRY(r10);
  32. ENTRY(r11);
  33. ENTRY(r12);
  34. ENTRY(r13);
  35. ENTRY(r14);
  36. ENTRY(r15);
  37. ENTRY(flags);
  38. BLANK();
  39. #undef ENTRY
  40. #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
  41. ENTRY(cr0);
  42. ENTRY(cr2);
  43. ENTRY(cr3);
  44. ENTRY(cr4);
  45. ENTRY(cr8);
  46. ENTRY(gdt_desc);
  47. BLANK();
  48. #undef ENTRY
  49. OFFSET(TSS_ist, tss_struct, x86_tss.ist);
  50. OFFSET(TSS_sp0, tss_struct, x86_tss.sp0);
  51. BLANK();
  52. #ifdef CONFIG_CC_STACKPROTECTOR
  53. DEFINE(stack_canary_offset, offsetof(union irq_stack_union, stack_canary));
  54. BLANK();
  55. #endif
  56. DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
  57. DEFINE(NR_syscalls, sizeof(syscalls_64));
  58. DEFINE(__NR_syscall_compat_max, sizeof(syscalls_ia32) - 1);
  59. DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
  60. return 0;
  61. }