asm-offsets_32.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 <linux/efi.h>
  6. #include <asm/ucontext.h>
  7. /* workaround for a warning with -Wmissing-prototypes */
  8. void foo(void);
  9. void foo(void)
  10. {
  11. OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
  12. OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
  13. OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
  14. OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
  15. OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
  16. OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
  17. OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
  18. BLANK();
  19. OFFSET(PT_EBX, pt_regs, bx);
  20. OFFSET(PT_ECX, pt_regs, cx);
  21. OFFSET(PT_EDX, pt_regs, dx);
  22. OFFSET(PT_ESI, pt_regs, si);
  23. OFFSET(PT_EDI, pt_regs, di);
  24. OFFSET(PT_EBP, pt_regs, bp);
  25. OFFSET(PT_EAX, pt_regs, ax);
  26. OFFSET(PT_DS, pt_regs, ds);
  27. OFFSET(PT_ES, pt_regs, es);
  28. OFFSET(PT_FS, pt_regs, fs);
  29. OFFSET(PT_GS, pt_regs, gs);
  30. OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
  31. OFFSET(PT_EIP, pt_regs, ip);
  32. OFFSET(PT_CS, pt_regs, cs);
  33. OFFSET(PT_EFLAGS, pt_regs, flags);
  34. OFFSET(PT_OLDESP, pt_regs, sp);
  35. OFFSET(PT_OLDSS, pt_regs, ss);
  36. BLANK();
  37. OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
  38. BLANK();
  39. /*
  40. * Offset from the entry stack to task stack stored in TSS. Kernel entry
  41. * happens on the per-cpu entry-stack, and the asm code switches to the
  42. * task-stack pointer stored in x86_tss.sp1, which is a copy of
  43. * task->thread.sp0 where entry code can find it.
  44. */
  45. DEFINE(TSS_entry2task_stack,
  46. offsetof(struct cpu_entry_area, tss.x86_tss.sp1) -
  47. offsetofend(struct cpu_entry_area, entry_stack_page.stack));
  48. #ifdef CONFIG_STACKPROTECTOR
  49. BLANK();
  50. OFFSET(stack_canary_offset, stack_canary, canary);
  51. #endif
  52. BLANK();
  53. DEFINE(EFI_svam, offsetof(efi_runtime_services_t, set_virtual_address_map));
  54. }