Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #ifndef __LINUX_KBUILD_H
0003 # error "Please do not build this file directly, build asm-offsets.c instead"
0004 #endif
0005 
0006 #include <linux/efi.h>
0007 
0008 #include <asm/ucontext.h>
0009 
0010 /* workaround for a warning with -Wmissing-prototypes */
0011 void foo(void);
0012 
0013 void foo(void)
0014 {
0015     OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
0016     OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
0017     OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
0018     OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
0019     OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
0020     OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
0021     OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
0022     BLANK();
0023 
0024     OFFSET(PT_EBX, pt_regs, bx);
0025     OFFSET(PT_ECX, pt_regs, cx);
0026     OFFSET(PT_EDX, pt_regs, dx);
0027     OFFSET(PT_ESI, pt_regs, si);
0028     OFFSET(PT_EDI, pt_regs, di);
0029     OFFSET(PT_EBP, pt_regs, bp);
0030     OFFSET(PT_EAX, pt_regs, ax);
0031     OFFSET(PT_DS,  pt_regs, ds);
0032     OFFSET(PT_ES,  pt_regs, es);
0033     OFFSET(PT_FS,  pt_regs, fs);
0034     OFFSET(PT_GS,  pt_regs, gs);
0035     OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
0036     OFFSET(PT_EIP, pt_regs, ip);
0037     OFFSET(PT_CS,  pt_regs, cs);
0038     OFFSET(PT_EFLAGS, pt_regs, flags);
0039     OFFSET(PT_OLDESP, pt_regs, sp);
0040     OFFSET(PT_OLDSS,  pt_regs, ss);
0041     BLANK();
0042 
0043     OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
0044     BLANK();
0045 
0046     /*
0047      * Offset from the entry stack to task stack stored in TSS. Kernel entry
0048      * happens on the per-cpu entry-stack, and the asm code switches to the
0049      * task-stack pointer stored in x86_tss.sp1, which is a copy of
0050      * task->thread.sp0 where entry code can find it.
0051      */
0052     DEFINE(TSS_entry2task_stack,
0053            offsetof(struct cpu_entry_area, tss.x86_tss.sp1) -
0054            offsetofend(struct cpu_entry_area, entry_stack_page.stack));
0055 
0056     BLANK();
0057     DEFINE(EFI_svam, offsetof(efi_runtime_services_t, set_virtual_address_map));
0058 }