xref: /openbmc/linux/arch/x86/kernel/asm-offsets_32.c (revision 48c926cd)
1 #ifndef __LINUX_KBUILD_H
2 # error "Please do not build this file directly, build asm-offsets.c instead"
3 #endif
4 
5 #include <asm/ucontext.h>
6 
7 #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
8 static char syscalls[] = {
9 #include <asm/syscalls_32.h>
10 };
11 
12 /* workaround for a warning with -Wmissing-prototypes */
13 void foo(void);
14 
15 void foo(void)
16 {
17 	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
18 	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
19 	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
20 	OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
21 	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
22 	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
23 	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
24 	BLANK();
25 
26 	OFFSET(PT_EBX, pt_regs, bx);
27 	OFFSET(PT_ECX, pt_regs, cx);
28 	OFFSET(PT_EDX, pt_regs, dx);
29 	OFFSET(PT_ESI, pt_regs, si);
30 	OFFSET(PT_EDI, pt_regs, di);
31 	OFFSET(PT_EBP, pt_regs, bp);
32 	OFFSET(PT_EAX, pt_regs, ax);
33 	OFFSET(PT_DS,  pt_regs, ds);
34 	OFFSET(PT_ES,  pt_regs, es);
35 	OFFSET(PT_FS,  pt_regs, fs);
36 	OFFSET(PT_GS,  pt_regs, gs);
37 	OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
38 	OFFSET(PT_EIP, pt_regs, ip);
39 	OFFSET(PT_CS,  pt_regs, cs);
40 	OFFSET(PT_EFLAGS, pt_regs, flags);
41 	OFFSET(PT_OLDESP, pt_regs, sp);
42 	OFFSET(PT_OLDSS,  pt_regs, ss);
43 	BLANK();
44 
45 	OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
46 	BLANK();
47 
48 	/* Offset from the sysenter stack to tss.sp0 */
49 	DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
50 	       offsetofend(struct tss_struct, SYSENTER_stack));
51 
52 	/* Offset from cpu_tss to SYSENTER_stack */
53 	OFFSET(CPU_TSS_SYSENTER_stack, tss_struct, SYSENTER_stack);
54 	/* Size of SYSENTER_stack */
55 	DEFINE(SIZEOF_SYSENTER_stack, sizeof(((struct tss_struct *)0)->SYSENTER_stack));
56 
57 #ifdef CONFIG_CC_STACKPROTECTOR
58 	BLANK();
59 	OFFSET(stack_canary_offset, stack_canary, canary);
60 #endif
61 
62 	BLANK();
63 	DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
64 	DEFINE(NR_syscalls, sizeof(syscalls));
65 }
66