asm-offsets_64.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #ifdef CONFIG_PARAVIRT_XXL
  21. OFFSET(PV_CPU_usergs_sysret64, paravirt_patch_template,
  22. cpu.usergs_sysret64);
  23. OFFSET(PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs);
  24. #ifdef CONFIG_DEBUG_ENTRY
  25. OFFSET(PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl);
  26. #endif
  27. #endif
  28. BLANK();
  29. #endif
  30. #if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS)
  31. OFFSET(KVM_STEAL_TIME_preempted, kvm_steal_time, preempted);
  32. BLANK();
  33. #endif
  34. #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
  35. ENTRY(bx);
  36. ENTRY(cx);
  37. ENTRY(dx);
  38. ENTRY(sp);
  39. ENTRY(bp);
  40. ENTRY(si);
  41. ENTRY(di);
  42. ENTRY(r8);
  43. ENTRY(r9);
  44. ENTRY(r10);
  45. ENTRY(r11);
  46. ENTRY(r12);
  47. ENTRY(r13);
  48. ENTRY(r14);
  49. ENTRY(r15);
  50. ENTRY(flags);
  51. BLANK();
  52. #undef ENTRY
  53. #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
  54. ENTRY(cr0);
  55. ENTRY(cr2);
  56. ENTRY(cr3);
  57. ENTRY(cr4);
  58. ENTRY(cr8);
  59. ENTRY(gdt_desc);
  60. BLANK();
  61. #undef ENTRY
  62. OFFSET(TSS_ist, tss_struct, x86_tss.ist);
  63. BLANK();
  64. #ifdef CONFIG_STACKPROTECTOR
  65. DEFINE(stack_canary_offset, offsetof(union irq_stack_union, stack_canary));
  66. BLANK();
  67. #endif
  68. DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
  69. DEFINE(NR_syscalls, sizeof(syscalls_64));
  70. DEFINE(__NR_syscall_compat_max, sizeof(syscalls_ia32) - 1);
  71. DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
  72. return 0;
  73. }