blob: d67c4be3e8b1e24ec845ecdb4c5de615523cf066 [file] [log] [blame]
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02001#include <asm/ucontext.h>
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02002
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02003#include <linux/lguest.h>
4#include "../../../drivers/lguest/lg.h"
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02005
H. Peter Anvin303395a2011-11-11 16:07:41 -08006#define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
7static char syscalls[] = {
8#include <asm/syscalls_32.h>
9};
10
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020011/* workaround for a warning with -Wmissing-prototypes */
12void foo(void);
13
14void foo(void)
15{
H. Peter Anvin742fa542008-01-30 13:30:56 +010016 OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
17 OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
18 OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
19 OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
20 OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
21 OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
22 OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
23 OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
24 OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020025 BLANK();
26
27 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
28 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
29 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
30 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020031 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
32 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
33 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
34 BLANK();
35
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020036 OFFSET(TI_sysenter_return, thread_info, sysenter_return);
37 OFFSET(TI_cpu, thread_info, cpu);
38 BLANK();
39
H. Peter Anvin65ea5b02008-01-30 13:30:56 +010040 OFFSET(PT_EBX, pt_regs, bx);
41 OFFSET(PT_ECX, pt_regs, cx);
42 OFFSET(PT_EDX, pt_regs, dx);
43 OFFSET(PT_ESI, pt_regs, si);
44 OFFSET(PT_EDI, pt_regs, di);
45 OFFSET(PT_EBP, pt_regs, bp);
46 OFFSET(PT_EAX, pt_regs, ax);
47 OFFSET(PT_DS, pt_regs, ds);
48 OFFSET(PT_ES, pt_regs, es);
49 OFFSET(PT_FS, pt_regs, fs);
Tejun Heoccbeed32009-02-09 22:17:40 +090050 OFFSET(PT_GS, pt_regs, gs);
H. Peter Anvin65ea5b02008-01-30 13:30:56 +010051 OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
52 OFFSET(PT_EIP, pt_regs, ip);
53 OFFSET(PT_CS, pt_regs, cs);
54 OFFSET(PT_EFLAGS, pt_regs, flags);
55 OFFSET(PT_OLDESP, pt_regs, sp);
56 OFFSET(PT_OLDSS, pt_regs, ss);
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020057 BLANK();
58
Roland McGrath108b5452008-01-30 13:30:41 +010059 OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020060 BLANK();
61
Konrad Rzeszutek Wilkcc456c42013-05-01 21:53:30 -040062 OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
63 BLANK();
64
H. Peter Anvinfaca6222008-01-30 13:31:02 +010065 /* Offset from the sysenter stack to tss.sp0 */
66 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020067 sizeof(struct tss_struct));
68
Tony Breedsdb342d22008-02-19 08:16:03 +010069#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020070 BLANK();
71 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
Rusty Russell61f4bc82009-06-12 22:27:03 -060072 OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
Rusty Russellf6c540c2008-02-04 07:11:10 +110073
Rusty Russellf6c540c2008-02-04 07:11:10 +110074 BLANK();
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020075 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
76 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
77 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
78 OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
79 OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
80 OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
81 OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
82 OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
83 OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
84 OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
85#endif
H. Peter Anvin303395a2011-11-11 16:07:41 -080086 BLANK();
87 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
88 DEFINE(NR_syscalls, sizeof(syscalls));
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020089}