diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:12:08 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:12:08 -0400 |
commit | 8d0d37cfb8039939f51dd2a1da98aff3b50a4e84 (patch) | |
tree | 465c836edb2f222dda66545bea0b568a59319c25 /arch/i386/kernel/asm-offsets_32.c | |
parent | 08eafb9b2808d8684e55c204609513e924e2da3c (diff) |
i386: prepare shared kernel/asm-offsets.c
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/i386/kernel/asm-offsets_32.c')
-rw-r--r-- | arch/i386/kernel/asm-offsets_32.c | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/arch/i386/kernel/asm-offsets_32.c b/arch/i386/kernel/asm-offsets_32.c new file mode 100644 index 000000000000..7288ac88d746 --- /dev/null +++ b/arch/i386/kernel/asm-offsets_32.c | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * Generate definitions needed by assembly language modules. | ||
3 | * This code generates raw asm output which is post-processed | ||
4 | * to extract and format the required data. | ||
5 | */ | ||
6 | |||
7 | #include <linux/crypto.h> | ||
8 | #include <linux/sched.h> | ||
9 | #include <linux/signal.h> | ||
10 | #include <linux/personality.h> | ||
11 | #include <linux/suspend.h> | ||
12 | #include <asm/ucontext.h> | ||
13 | #include "sigframe.h" | ||
14 | #include <asm/pgtable.h> | ||
15 | #include <asm/fixmap.h> | ||
16 | #include <asm/processor.h> | ||
17 | #include <asm/thread_info.h> | ||
18 | #include <asm/elf.h> | ||
19 | |||
20 | #include <xen/interface/xen.h> | ||
21 | |||
22 | #ifdef CONFIG_LGUEST_GUEST | ||
23 | #include <linux/lguest.h> | ||
24 | #include "../../../drivers/lguest/lg.h" | ||
25 | #endif | ||
26 | |||
27 | #define DEFINE(sym, val) \ | ||
28 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
29 | |||
30 | #define BLANK() asm volatile("\n->" : : ) | ||
31 | |||
32 | #define OFFSET(sym, str, mem) \ | ||
33 | DEFINE(sym, offsetof(struct str, mem)); | ||
34 | |||
35 | /* workaround for a warning with -Wmissing-prototypes */ | ||
36 | void foo(void); | ||
37 | |||
38 | void foo(void) | ||
39 | { | ||
40 | OFFSET(SIGCONTEXT_eax, sigcontext, eax); | ||
41 | OFFSET(SIGCONTEXT_ebx, sigcontext, ebx); | ||
42 | OFFSET(SIGCONTEXT_ecx, sigcontext, ecx); | ||
43 | OFFSET(SIGCONTEXT_edx, sigcontext, edx); | ||
44 | OFFSET(SIGCONTEXT_esi, sigcontext, esi); | ||
45 | OFFSET(SIGCONTEXT_edi, sigcontext, edi); | ||
46 | OFFSET(SIGCONTEXT_ebp, sigcontext, ebp); | ||
47 | OFFSET(SIGCONTEXT_esp, sigcontext, esp); | ||
48 | OFFSET(SIGCONTEXT_eip, sigcontext, eip); | ||
49 | BLANK(); | ||
50 | |||
51 | OFFSET(CPUINFO_x86, cpuinfo_x86, x86); | ||
52 | OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor); | ||
53 | OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model); | ||
54 | OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask); | ||
55 | OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math); | ||
56 | OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level); | ||
57 | OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability); | ||
58 | OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id); | ||
59 | BLANK(); | ||
60 | |||
61 | OFFSET(TI_task, thread_info, task); | ||
62 | OFFSET(TI_exec_domain, thread_info, exec_domain); | ||
63 | OFFSET(TI_flags, thread_info, flags); | ||
64 | OFFSET(TI_status, thread_info, status); | ||
65 | OFFSET(TI_preempt_count, thread_info, preempt_count); | ||
66 | OFFSET(TI_addr_limit, thread_info, addr_limit); | ||
67 | OFFSET(TI_restart_block, thread_info, restart_block); | ||
68 | OFFSET(TI_sysenter_return, thread_info, sysenter_return); | ||
69 | OFFSET(TI_cpu, thread_info, cpu); | ||
70 | BLANK(); | ||
71 | |||
72 | OFFSET(GDS_size, Xgt_desc_struct, size); | ||
73 | OFFSET(GDS_address, Xgt_desc_struct, address); | ||
74 | OFFSET(GDS_pad, Xgt_desc_struct, pad); | ||
75 | BLANK(); | ||
76 | |||
77 | OFFSET(PT_EBX, pt_regs, ebx); | ||
78 | OFFSET(PT_ECX, pt_regs, ecx); | ||
79 | OFFSET(PT_EDX, pt_regs, edx); | ||
80 | OFFSET(PT_ESI, pt_regs, esi); | ||
81 | OFFSET(PT_EDI, pt_regs, edi); | ||
82 | OFFSET(PT_EBP, pt_regs, ebp); | ||
83 | OFFSET(PT_EAX, pt_regs, eax); | ||
84 | OFFSET(PT_DS, pt_regs, xds); | ||
85 | OFFSET(PT_ES, pt_regs, xes); | ||
86 | OFFSET(PT_FS, pt_regs, xfs); | ||
87 | OFFSET(PT_ORIG_EAX, pt_regs, orig_eax); | ||
88 | OFFSET(PT_EIP, pt_regs, eip); | ||
89 | OFFSET(PT_CS, pt_regs, xcs); | ||
90 | OFFSET(PT_EFLAGS, pt_regs, eflags); | ||
91 | OFFSET(PT_OLDESP, pt_regs, esp); | ||
92 | OFFSET(PT_OLDSS, pt_regs, xss); | ||
93 | BLANK(); | ||
94 | |||
95 | OFFSET(EXEC_DOMAIN_handler, exec_domain, handler); | ||
96 | OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext); | ||
97 | BLANK(); | ||
98 | |||
99 | OFFSET(pbe_address, pbe, address); | ||
100 | OFFSET(pbe_orig_address, pbe, orig_address); | ||
101 | OFFSET(pbe_next, pbe, next); | ||
102 | |||
103 | /* Offset from the sysenter stack to tss.esp0 */ | ||
104 | DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, x86_tss.esp0) - | ||
105 | sizeof(struct tss_struct)); | ||
106 | |||
107 | DEFINE(PAGE_SIZE_asm, PAGE_SIZE); | ||
108 | DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT); | ||
109 | DEFINE(PTRS_PER_PTE, PTRS_PER_PTE); | ||
110 | DEFINE(PTRS_PER_PMD, PTRS_PER_PMD); | ||
111 | DEFINE(PTRS_PER_PGD, PTRS_PER_PGD); | ||
112 | |||
113 | DEFINE(VDSO_PRELINK_asm, VDSO_PRELINK); | ||
114 | |||
115 | OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); | ||
116 | |||
117 | #ifdef CONFIG_PARAVIRT | ||
118 | BLANK(); | ||
119 | OFFSET(PARAVIRT_enabled, paravirt_ops, paravirt_enabled); | ||
120 | OFFSET(PARAVIRT_irq_disable, paravirt_ops, irq_disable); | ||
121 | OFFSET(PARAVIRT_irq_enable, paravirt_ops, irq_enable); | ||
122 | OFFSET(PARAVIRT_irq_enable_sysexit, paravirt_ops, irq_enable_sysexit); | ||
123 | OFFSET(PARAVIRT_iret, paravirt_ops, iret); | ||
124 | OFFSET(PARAVIRT_read_cr0, paravirt_ops, read_cr0); | ||
125 | #endif | ||
126 | |||
127 | #ifdef CONFIG_XEN | ||
128 | BLANK(); | ||
129 | OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask); | ||
130 | OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending); | ||
131 | #endif | ||
132 | |||
133 | #ifdef CONFIG_LGUEST_GUEST | ||
134 | BLANK(); | ||
135 | OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled); | ||
136 | OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc); | ||
137 | OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc); | ||
138 | OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3); | ||
139 | OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp); | ||
140 | OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc); | ||
141 | OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc); | ||
142 | OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt); | ||
143 | OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum); | ||
144 | OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode); | ||
145 | OFFSET(LGUEST_PAGES_regs, lguest_pages, regs); | ||
146 | #endif | ||
147 | } | ||