asm-offsets_64.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS)
  7. #include <asm/kvm_para.h>
  8. #endif
  9. int main(void)
  10. {
  11. #ifdef CONFIG_PARAVIRT
  12. #ifdef CONFIG_PARAVIRT_XXL
  13. OFFSET(PV_CPU_usergs_sysret64, paravirt_patch_template,
  14. cpu.usergs_sysret64);
  15. #ifdef CONFIG_DEBUG_ENTRY
  16. OFFSET(PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl);
  17. #endif
  18. #endif
  19. BLANK();
  20. #endif
  21. #if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS)
  22. OFFSET(KVM_STEAL_TIME_preempted, kvm_steal_time, preempted);
  23. BLANK();
  24. #endif
  25. #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry)
  26. ENTRY(bx);
  27. ENTRY(cx);
  28. ENTRY(dx);
  29. ENTRY(sp);
  30. ENTRY(bp);
  31. ENTRY(si);
  32. ENTRY(di);
  33. ENTRY(r8);
  34. ENTRY(r9);
  35. ENTRY(r10);
  36. ENTRY(r11);
  37. ENTRY(r12);
  38. ENTRY(r13);
  39. ENTRY(r14);
  40. ENTRY(r15);
  41. ENTRY(flags);
  42. BLANK();
  43. #undef ENTRY
  44. #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry)
  45. ENTRY(cr0);
  46. ENTRY(cr2);
  47. ENTRY(cr3);
  48. ENTRY(cr4);
  49. ENTRY(gdt_desc);
  50. BLANK();
  51. #undef ENTRY
  52. BLANK();
  53. #ifdef CONFIG_STACKPROTECTOR
  54. DEFINE(stack_canary_offset, offsetof(struct fixed_percpu_data, stack_canary));
  55. BLANK();
  56. #endif
  57. return 0;
  58. }