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