asm-offsets_64.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // SPDX-License-Identifier: GPL-2.0
  2. #ifndef __LINUX_KBUILD_H
  3. # error "Please do not build this file directly, build asm-offsets.c instead"
  4. #endif
  5. #include <asm/ia32.h>
  6. #define __SYSCALL_64(nr, sym, qual) [nr] = 1,
  7. static char syscalls_64[] = {
  8. #include <asm/syscalls_64.h>
  9. };
  10. #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
  11. static char syscalls_ia32[] = {
  12. #include <asm/syscalls_32.h>
  13. };
  14. #if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS)
  15. #include <asm/kvm_para.h>
  16. #endif
  17. int main(void)
  18. {
  19. #ifdef CONFIG_PARAVIRT
  20. OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
  21. OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
  22. #ifdef CONFIG_DEBUG_ENTRY
  23. OFFSET(PV_IRQ_save_fl, pv_irq_ops, save_fl);
  24. #endif
  25. BLANK();
  26. #endif
  27. #if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS)
  28. OFFSET(KVM_STEAL_TIME_preempted, kvm_steal_time, preempted);
  29. BLANK();
  30. #endif
  31. #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
  32. ENTRY(bx);
  33. ENTRY(cx);
  34. ENTRY(dx);
  35. ENTRY(sp);
  36. ENTRY(bp);
  37. ENTRY(si);
  38. ENTRY(di);
  39. ENTRY(r8);
  40. ENTRY(r9);
  41. ENTRY(r10);
  42. ENTRY(r11);
  43. ENTRY(r12);
  44. ENTRY(r13);
  45. ENTRY(r14);
  46. ENTRY(r15);
  47. ENTRY(flags);
  48. BLANK();
  49. #undef ENTRY
  50. #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
  51. ENTRY(cr0);
  52. ENTRY(cr2);
  53. ENTRY(cr3);
  54. ENTRY(cr4);
  55. ENTRY(cr8);
  56. ENTRY(gdt_desc);
  57. BLANK();
  58. #undef ENTRY
  59. OFFSET(TSS_ist, tss_struct, x86_tss.ist);
  60. BLANK();
  61. #ifdef CONFIG_STACKPROTECTOR
  62. DEFINE(stack_canary_offset, offsetof(union irq_stack_union, stack_canary));
  63. BLANK();
  64. #endif
  65. DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
  66. DEFINE(NR_syscalls, sizeof(syscalls_64));
  67. DEFINE(__NR_syscall_compat_max, sizeof(syscalls_ia32) - 1);
  68. DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
  69. return 0;
  70. }