asm-offsets_64.c 1.7 KB

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