blob: ecdc1d217dc0f50a7b760c25cec8bee586643336 [file] [log] [blame]
Borislav Petkov5de2b612014-12-09 16:45:17 +01001#ifndef __LINUX_KBUILD_H
2# error "Please do not build this file directly, build asm-offsets.c instead"
3#endif
4
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02005#include <asm/ucontext.h>
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02006
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02007#include <linux/lguest.h>
8#include "../../../drivers/lguest/lg.h"
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +02009
Andy Lutomirskicfcbadb2016-01-28 15:11:24 -080010#define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
H. Peter Anvin303395a2011-11-11 16:07:41 -080011static char syscalls[] = {
12#include <asm/syscalls_32.h>
13};
14
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020015/* workaround for a warning with -Wmissing-prototypes */
16void foo(void);
17
18void foo(void)
19{
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020020 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);
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020024 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
H. Peter Anvin65ea5b02008-01-30 13:30:56 +010029 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);
Tejun Heoccbeed32009-02-09 22:17:40 +090039 OFFSET(PT_GS, pt_regs, gs);
H. Peter Anvin65ea5b02008-01-30 13:30:56 +010040 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);
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020046 BLANK();
47
Konrad Rzeszutek Wilkcc456c42013-05-01 21:53:30 -040048 OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
49 BLANK();
50
H. Peter Anvinfaca6222008-01-30 13:31:02 +010051 /* Offset from the sysenter stack to tss.sp0 */
52 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
Denys Vlasenkod828c712015-03-09 15:52:18 +010053 offsetofend(struct tss_struct, SYSENTER_stack));
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020054
Andy Lutomirski75366562016-03-09 19:00:32 -080055 /* 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
Tony Breedsdb342d22008-02-19 08:16:03 +010060#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020061 BLANK();
62 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
Rusty Russell61f4bc82009-06-12 22:27:03 -060063 OFFSET(LGUEST_DATA_irq_pending, lguest_data, irq_pending);
Rusty Russellf6c540c2008-02-04 07:11:10 +110064
Rusty Russellf6c540c2008-02-04 07:11:10 +110065 BLANK();
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020066 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
67 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
68 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
69 OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
70 OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
71 OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
72 OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
73 OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
74 OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
75 OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
76#endif
H. Peter Anvin303395a2011-11-11 16:07:41 -080077 BLANK();
78 DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
79 DEFINE(NR_syscalls, sizeof(syscalls));
Thomas Gleixner8d0d37c2007-10-11 11:12:08 +020080}