Loading...
1#include <asm/ucontext.h>
2
3#include <linux/lguest.h>
4#include "../../../drivers/lguest/lg.h"
5
6#define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
7static char syscalls[] = {
8#include <asm/syscalls_32.h>
9};
10
11/* workaround for a warning with -Wmissing-prototypes */
12void foo(void);
13
14void foo(void)
15{
16 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);
25 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);
31 OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
32 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
33 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
34 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
35 BLANK();
36
37 OFFSET(TI_sysenter_return, thread_info, sysenter_return);
38 OFFSET(TI_cpu, thread_info, cpu);
39 BLANK();
40
41 OFFSET(PT_EBX, pt_regs, bx);
42 OFFSET(PT_ECX, pt_regs, cx);
43 OFFSET(PT_EDX, pt_regs, dx);
44 OFFSET(PT_ESI, pt_regs, si);
45 OFFSET(PT_EDI, pt_regs, di);
46 OFFSET(PT_EBP, pt_regs, bp);
47 OFFSET(PT_EAX, pt_regs, ax);
48 OFFSET(PT_DS, pt_regs, ds);
49 OFFSET(PT_ES, pt_regs, es);
50 OFFSET(PT_FS, pt_regs, fs);
51 OFFSET(PT_GS, pt_regs, gs);
52 OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
53 OFFSET(PT_EIP, pt_regs, ip);
54 OFFSET(PT_CS, pt_regs, cs);
55 OFFSET(PT_EFLAGS, pt_regs, flags);
56 OFFSET(PT_OLDESP, pt_regs, sp);
57 OFFSET(PT_OLDSS, pt_regs, ss);
58 BLANK();
59
60 OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
61 BLANK();
62
63 /* Offset from the sysenter stack to tss.sp0 */
64 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
65 sizeof(struct tss_struct));
66
67#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
68 BLANK();
69 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
70 OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
71
72 BLANK();
73 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
74 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
75 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
76 OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
77 OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
78 OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
79 OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
80 OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
81 OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
82 OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
83#endif
84 BLANK();
85 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
86 DEFINE(NR_syscalls, sizeof(syscalls));
87}
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#include <linux/lguest.h>
8#include "../../../drivers/lguest/lg.h"
9
10#define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
11static char syscalls[] = {
12#include <asm/syscalls_32.h>
13};
14
15/* workaround for a warning with -Wmissing-prototypes */
16void foo(void);
17
18void foo(void)
19{
20 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
21 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
22 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
23 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
24 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
25 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
26 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
27 BLANK();
28
29 OFFSET(PT_EBX, pt_regs, bx);
30 OFFSET(PT_ECX, pt_regs, cx);
31 OFFSET(PT_EDX, pt_regs, dx);
32 OFFSET(PT_ESI, pt_regs, si);
33 OFFSET(PT_EDI, pt_regs, di);
34 OFFSET(PT_EBP, pt_regs, bp);
35 OFFSET(PT_EAX, pt_regs, ax);
36 OFFSET(PT_DS, pt_regs, ds);
37 OFFSET(PT_ES, pt_regs, es);
38 OFFSET(PT_FS, pt_regs, fs);
39 OFFSET(PT_GS, pt_regs, gs);
40 OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
41 OFFSET(PT_EIP, pt_regs, ip);
42 OFFSET(PT_CS, pt_regs, cs);
43 OFFSET(PT_EFLAGS, pt_regs, flags);
44 OFFSET(PT_OLDESP, pt_regs, sp);
45 OFFSET(PT_OLDSS, pt_regs, ss);
46 BLANK();
47
48 OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
49 BLANK();
50
51 /* Offset from the sysenter stack to tss.sp0 */
52 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
53 offsetofend(struct tss_struct, SYSENTER_stack));
54
55 /* Offset from cpu_tss to SYSENTER_stack */
56 OFFSET(CPU_TSS_SYSENTER_stack, tss_struct, SYSENTER_stack);
57 /* Size of SYSENTER_stack */
58 DEFINE(SIZEOF_SYSENTER_stack, sizeof(((struct tss_struct *)0)->SYSENTER_stack));
59
60#ifdef CONFIG_CC_STACKPROTECTOR
61 BLANK();
62 OFFSET(stack_canary_offset, stack_canary, canary);
63#endif
64
65#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
66 BLANK();
67 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
68 OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
69
70 BLANK();
71 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
72 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
73 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
74 OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
75 OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
76 OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
77 OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
78 OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
79 OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
80 OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
81#endif
82 BLANK();
83 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
84 DEFINE(NR_syscalls, sizeof(syscalls));
85}