xref: /linux/arch/x86/kernel/asm-offsets_32.c (revision 3fb0fdb3)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
25de2b61aSBorislav Petkov #ifndef __LINUX_KBUILD_H
35de2b61aSBorislav Petkov # error "Please do not build this file directly, build asm-offsets.c instead"
45de2b61aSBorislav Petkov #endif
55de2b61aSBorislav Petkov 
6*59f2a619SArd Biesheuvel #include <linux/efi.h>
7*59f2a619SArd Biesheuvel 
89a163ed8SThomas Gleixner #include <asm/ucontext.h>
99a163ed8SThomas Gleixner 
109a163ed8SThomas Gleixner /* workaround for a warning with -Wmissing-prototypes */
119a163ed8SThomas Gleixner void foo(void);
129a163ed8SThomas Gleixner 
foo(void)139a163ed8SThomas Gleixner void foo(void)
149a163ed8SThomas Gleixner {
159a163ed8SThomas Gleixner 	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
169a163ed8SThomas Gleixner 	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
179a163ed8SThomas Gleixner 	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
18b399151cSJia Zhang 	OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
199a163ed8SThomas Gleixner 	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
209a163ed8SThomas Gleixner 	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
219a163ed8SThomas Gleixner 	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
229a163ed8SThomas Gleixner 	BLANK();
239a163ed8SThomas Gleixner 
2465ea5b03SH. Peter Anvin 	OFFSET(PT_EBX, pt_regs, bx);
2565ea5b03SH. Peter Anvin 	OFFSET(PT_ECX, pt_regs, cx);
2665ea5b03SH. Peter Anvin 	OFFSET(PT_EDX, pt_regs, dx);
2765ea5b03SH. Peter Anvin 	OFFSET(PT_ESI, pt_regs, si);
2865ea5b03SH. Peter Anvin 	OFFSET(PT_EDI, pt_regs, di);
2965ea5b03SH. Peter Anvin 	OFFSET(PT_EBP, pt_regs, bp);
3065ea5b03SH. Peter Anvin 	OFFSET(PT_EAX, pt_regs, ax);
3165ea5b03SH. Peter Anvin 	OFFSET(PT_DS,  pt_regs, ds);
3265ea5b03SH. Peter Anvin 	OFFSET(PT_ES,  pt_regs, es);
3365ea5b03SH. Peter Anvin 	OFFSET(PT_FS,  pt_regs, fs);
34ccbeed3aSTejun Heo 	OFFSET(PT_GS,  pt_regs, gs);
3565ea5b03SH. Peter Anvin 	OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
3665ea5b03SH. Peter Anvin 	OFFSET(PT_EIP, pt_regs, ip);
3765ea5b03SH. Peter Anvin 	OFFSET(PT_CS,  pt_regs, cs);
3865ea5b03SH. Peter Anvin 	OFFSET(PT_EFLAGS, pt_regs, flags);
3965ea5b03SH. Peter Anvin 	OFFSET(PT_OLDESP, pt_regs, sp);
4065ea5b03SH. Peter Anvin 	OFFSET(PT_OLDSS,  pt_regs, ss);
419a163ed8SThomas Gleixner 	BLANK();
429a163ed8SThomas Gleixner 
43cc456c4eSKonrad Rzeszutek Wilk 	OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
44cc456c4eSKonrad Rzeszutek Wilk 	BLANK();
45cc456c4eSKonrad Rzeszutek Wilk 
46a6b744f3SJoerg Roedel 	/*
47a6b744f3SJoerg Roedel 	 * Offset from the entry stack to task stack stored in TSS. Kernel entry
48a6b744f3SJoerg Roedel 	 * happens on the per-cpu entry-stack, and the asm code switches to the
49a6b744f3SJoerg Roedel 	 * task-stack pointer stored in x86_tss.sp1, which is a copy of
50a6b744f3SJoerg Roedel 	 * task->thread.sp0 where entry code can find it.
51a6b744f3SJoerg Roedel 	 */
52ae2e565bSJoerg Roedel 	DEFINE(TSS_entry2task_stack,
53a6b744f3SJoerg Roedel 	       offsetof(struct cpu_entry_area, tss.x86_tss.sp1) -
544fe2d8b1SDave Hansen 	       offsetofend(struct cpu_entry_area, entry_stack_page.stack));
559a163ed8SThomas Gleixner 
56303395acSH. Peter Anvin 	BLANK();
57*59f2a619SArd Biesheuvel 	DEFINE(EFI_svam, offsetof(efi_runtime_services_t, set_virtual_address_map));
589a163ed8SThomas Gleixner }
59