asm-offsets_32.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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/ucontext.h>
  6. #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
  7. static char syscalls[] = {
  8. #include <asm/syscalls_32.h>
  9. };
  10. /* workaround for a warning with -Wmissing-prototypes */
  11. void foo(void);
  12. void foo(void)
  13. {
  14. OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
  15. OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
  16. OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
  17. OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
  18. OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
  19. OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
  20. OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
  21. BLANK();
  22. OFFSET(PT_EBX, pt_regs, bx);
  23. OFFSET(PT_ECX, pt_regs, cx);
  24. OFFSET(PT_EDX, pt_regs, dx);
  25. OFFSET(PT_ESI, pt_regs, si);
  26. OFFSET(PT_EDI, pt_regs, di);
  27. OFFSET(PT_EBP, pt_regs, bp);
  28. OFFSET(PT_EAX, pt_regs, ax);
  29. OFFSET(PT_DS, pt_regs, ds);
  30. OFFSET(PT_ES, pt_regs, es);
  31. OFFSET(PT_FS, pt_regs, fs);
  32. OFFSET(PT_GS, pt_regs, gs);
  33. OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
  34. OFFSET(PT_EIP, pt_regs, ip);
  35. OFFSET(PT_CS, pt_regs, cs);
  36. OFFSET(PT_EFLAGS, pt_regs, flags);
  37. OFFSET(PT_OLDESP, pt_regs, sp);
  38. OFFSET(PT_OLDSS, pt_regs, ss);
  39. BLANK();
  40. OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
  41. BLANK();
  42. /* Offset from the sysenter stack to tss.sp0 */
  43. DEFINE(TSS_sysenter_sp0, offsetof(struct cpu_entry_area, tss.x86_tss.sp0) -
  44. offsetofend(struct cpu_entry_area, entry_stack_page.stack));
  45. #ifdef CONFIG_CC_STACKPROTECTOR
  46. BLANK();
  47. OFFSET(stack_canary_offset, stack_canary, canary);
  48. #endif
  49. BLANK();
  50. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  51. DEFINE(NR_syscalls, sizeof(syscalls));
  52. }