Loading...
1#include <asm/ucontext.h>
2
3#include <linux/lguest.h>
4#include "../../../drivers/lguest/lg.h"
5
6/* workaround for a warning with -Wmissing-prototypes */
7void foo(void);
8
9void foo(void)
10{
11 OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
12 OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
13 OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
14 OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
15 OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
16 OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
17 OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
18 OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
19 OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
20 BLANK();
21
22 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
23 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
24 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
25 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
26 OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
27 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
28 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
29 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
30 BLANK();
31
32 OFFSET(TI_sysenter_return, thread_info, sysenter_return);
33 OFFSET(TI_cpu, thread_info, cpu);
34 BLANK();
35
36 OFFSET(PT_EBX, pt_regs, bx);
37 OFFSET(PT_ECX, pt_regs, cx);
38 OFFSET(PT_EDX, pt_regs, dx);
39 OFFSET(PT_ESI, pt_regs, si);
40 OFFSET(PT_EDI, pt_regs, di);
41 OFFSET(PT_EBP, pt_regs, bp);
42 OFFSET(PT_EAX, pt_regs, ax);
43 OFFSET(PT_DS, pt_regs, ds);
44 OFFSET(PT_ES, pt_regs, es);
45 OFFSET(PT_FS, pt_regs, fs);
46 OFFSET(PT_GS, pt_regs, gs);
47 OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
48 OFFSET(PT_EIP, pt_regs, ip);
49 OFFSET(PT_CS, pt_regs, cs);
50 OFFSET(PT_EFLAGS, pt_regs, flags);
51 OFFSET(PT_OLDESP, pt_regs, sp);
52 OFFSET(PT_OLDSS, pt_regs, ss);
53 BLANK();
54
55 OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
56 BLANK();
57
58 /* Offset from the sysenter stack to tss.sp0 */
59 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
60 sizeof(struct tss_struct));
61
62#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
63 BLANK();
64 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
65 OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
66
67 BLANK();
68 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
69 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
70 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
71 OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
72 OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
73 OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
74 OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
75 OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
76 OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
77 OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
78#endif
79}
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 */
11void foo(void);
12
13void foo(void)
14{
15 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
16 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
17 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
18 OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
19 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
20 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
21 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
22 BLANK();
23
24 OFFSET(PT_EBX, pt_regs, bx);
25 OFFSET(PT_ECX, pt_regs, cx);
26 OFFSET(PT_EDX, pt_regs, dx);
27 OFFSET(PT_ESI, pt_regs, si);
28 OFFSET(PT_EDI, pt_regs, di);
29 OFFSET(PT_EBP, pt_regs, bp);
30 OFFSET(PT_EAX, pt_regs, ax);
31 OFFSET(PT_DS, pt_regs, ds);
32 OFFSET(PT_ES, pt_regs, es);
33 OFFSET(PT_FS, pt_regs, fs);
34 OFFSET(PT_GS, pt_regs, gs);
35 OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
36 OFFSET(PT_EIP, pt_regs, ip);
37 OFFSET(PT_CS, pt_regs, cs);
38 OFFSET(PT_EFLAGS, pt_regs, flags);
39 OFFSET(PT_OLDESP, pt_regs, sp);
40 OFFSET(PT_OLDSS, pt_regs, ss);
41 BLANK();
42
43 OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
44 BLANK();
45
46 /*
47 * Offset from the entry stack to task stack stored in TSS. Kernel entry
48 * happens on the per-cpu entry-stack, and the asm code switches to the
49 * task-stack pointer stored in x86_tss.sp1, which is a copy of
50 * task->thread.sp0 where entry code can find it.
51 */
52 DEFINE(TSS_entry2task_stack,
53 offsetof(struct cpu_entry_area, tss.x86_tss.sp1) -
54 offsetofend(struct cpu_entry_area, entry_stack_page.stack));
55
56 BLANK();
57 DEFINE(EFI_svam, offsetof(efi_runtime_services_t, set_virtual_address_map));
58}