Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / x86 / kernel / asm-offsets_32.c
blob3ac249232635d36092753c4b2c3e84ce268f9148
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 */
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_32.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/bootparam.h>
19 #include <asm/elf.h>
21 #include <xen/interface/xen.h>
23 <<<<<<< HEAD:arch/x86/kernel/asm-offsets_32.c
24 #ifdef CONFIG_LGUEST_GUEST
25 =======
26 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/x86/kernel/asm-offsets_32.c
27 #include <linux/lguest.h>
28 #include "../../../drivers/lguest/lg.h"
29 <<<<<<< HEAD:arch/x86/kernel/asm-offsets_32.c
30 #endif
31 =======
32 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/x86/kernel/asm-offsets_32.c
34 #define DEFINE(sym, val) \
35 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
37 #define BLANK() asm volatile("\n->" : : )
39 #define OFFSET(sym, str, mem) \
40 DEFINE(sym, offsetof(struct str, mem));
42 /* workaround for a warning with -Wmissing-prototypes */
43 void foo(void);
45 void foo(void)
47 OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
48 OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
49 OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
50 OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
51 OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
52 OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
53 OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
54 OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
55 OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
56 BLANK();
58 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
59 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
60 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
61 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
62 OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
63 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
64 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
65 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
66 BLANK();
68 OFFSET(TI_task, thread_info, task);
69 OFFSET(TI_exec_domain, thread_info, exec_domain);
70 OFFSET(TI_flags, thread_info, flags);
71 OFFSET(TI_status, thread_info, status);
72 OFFSET(TI_preempt_count, thread_info, preempt_count);
73 OFFSET(TI_addr_limit, thread_info, addr_limit);
74 OFFSET(TI_restart_block, thread_info, restart_block);
75 OFFSET(TI_sysenter_return, thread_info, sysenter_return);
76 OFFSET(TI_cpu, thread_info, cpu);
77 BLANK();
79 OFFSET(GDS_size, desc_ptr, size);
80 OFFSET(GDS_address, desc_ptr, address);
81 BLANK();
83 OFFSET(PT_EBX, pt_regs, bx);
84 OFFSET(PT_ECX, pt_regs, cx);
85 OFFSET(PT_EDX, pt_regs, dx);
86 OFFSET(PT_ESI, pt_regs, si);
87 OFFSET(PT_EDI, pt_regs, di);
88 OFFSET(PT_EBP, pt_regs, bp);
89 OFFSET(PT_EAX, pt_regs, ax);
90 OFFSET(PT_DS, pt_regs, ds);
91 OFFSET(PT_ES, pt_regs, es);
92 OFFSET(PT_FS, pt_regs, fs);
93 OFFSET(PT_ORIG_EAX, pt_regs, orig_ax);
94 OFFSET(PT_EIP, pt_regs, ip);
95 OFFSET(PT_CS, pt_regs, cs);
96 OFFSET(PT_EFLAGS, pt_regs, flags);
97 OFFSET(PT_OLDESP, pt_regs, sp);
98 OFFSET(PT_OLDSS, pt_regs, ss);
99 BLANK();
101 OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
102 OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
103 BLANK();
105 OFFSET(pbe_address, pbe, address);
106 OFFSET(pbe_orig_address, pbe, orig_address);
107 OFFSET(pbe_next, pbe, next);
109 /* Offset from the sysenter stack to tss.sp0 */
110 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
111 sizeof(struct tss_struct));
113 DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
114 DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT);
115 DEFINE(PTRS_PER_PTE, PTRS_PER_PTE);
116 DEFINE(PTRS_PER_PMD, PTRS_PER_PMD);
117 DEFINE(PTRS_PER_PGD, PTRS_PER_PGD);
119 OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
121 #ifdef CONFIG_PARAVIRT
122 BLANK();
123 OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
124 OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
125 OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
126 OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
127 OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
128 OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
129 OFFSET(PV_CPU_irq_enable_syscall_ret, pv_cpu_ops, irq_enable_syscall_ret);
130 OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
131 #endif
133 #ifdef CONFIG_XEN
134 BLANK();
135 OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
136 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
137 #endif
139 <<<<<<< HEAD:arch/x86/kernel/asm-offsets_32.c
140 #ifdef CONFIG_LGUEST_GUEST
141 =======
142 #if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE)
143 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/x86/kernel/asm-offsets_32.c
144 BLANK();
145 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
146 OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
147 <<<<<<< HEAD:arch/x86/kernel/asm-offsets_32.c
148 =======
150 BLANK();
151 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/x86/kernel/asm-offsets_32.c
152 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
153 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
154 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
155 OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
156 OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
157 OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
158 OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
159 OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
160 OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
161 OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
162 #endif
164 BLANK();
165 OFFSET(BP_scratch, boot_params, scratch);
166 OFFSET(BP_loadflags, boot_params, hdr.loadflags);
167 OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
168 OFFSET(BP_version, boot_params, hdr.version);