]> nv-tegra.nvidia Code Review - linux-2.6.git/blob - arch/x86/kernel/asm-offsets_64.c
x86-64: Convert irqstacks to per-cpu
[linux-2.6.git] / arch / x86 / kernel / asm-offsets_64.c
1 /*
2  * Generate definitions needed by assembly language modules.
3  * This code generates raw asm output which is post-processed to extract
4  * and format the required data.
5  */
6
7 #include <linux/crypto.h>
8 #include <linux/sched.h> 
9 #include <linux/stddef.h>
10 #include <linux/errno.h> 
11 #include <linux/hardirq.h>
12 #include <linux/suspend.h>
13 #include <linux/kbuild.h>
14 #include <asm/pda.h>
15 #include <asm/processor.h>
16 #include <asm/segment.h>
17 #include <asm/thread_info.h>
18 #include <asm/ia32.h>
19 #include <asm/bootparam.h>
20
21 #include <xen/interface/xen.h>
22
23 #include <asm/sigframe.h>
24
25 #define __NO_STUBS 1
26 #undef __SYSCALL
27 #undef _ASM_X86_UNISTD_64_H
28 #define __SYSCALL(nr, sym) [nr] = 1,
29 static char syscalls[] = {
30 #include <asm/unistd.h>
31 };
32
33 int main(void)
34 {
35 #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
36         ENTRY(state);
37         ENTRY(flags); 
38         ENTRY(pid);
39         BLANK();
40 #undef ENTRY
41 #define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
42         ENTRY(flags);
43         ENTRY(addr_limit);
44         ENTRY(preempt_count);
45         ENTRY(status);
46 #ifdef CONFIG_IA32_EMULATION
47         ENTRY(sysenter_return);
48 #endif
49         BLANK();
50 #undef ENTRY
51 #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
52         ENTRY(kernelstack); 
53         ENTRY(oldrsp); 
54         ENTRY(pcurrent); 
55         ENTRY(irqcount);
56         ENTRY(cpunumber);
57         DEFINE(pda_size, sizeof(struct x8664_pda));
58         BLANK();
59 #undef ENTRY
60 #ifdef CONFIG_PARAVIRT
61         BLANK();
62         OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled);
63         OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
64         OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
65         OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
66         OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
67         OFFSET(PV_IRQ_adjust_exception_frame, pv_irq_ops, adjust_exception_frame);
68         OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
69         OFFSET(PV_CPU_usergs_sysret32, pv_cpu_ops, usergs_sysret32);
70         OFFSET(PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);
71         OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
72         OFFSET(PV_CPU_swapgs, pv_cpu_ops, swapgs);
73         OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
74 #endif
75
76
77 #ifdef CONFIG_IA32_EMULATION
78 #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
79         ENTRY(ax);
80         ENTRY(bx);
81         ENTRY(cx);
82         ENTRY(dx);
83         ENTRY(si);
84         ENTRY(di);
85         ENTRY(bp);
86         ENTRY(sp);
87         ENTRY(ip);
88         BLANK();
89 #undef ENTRY
90         DEFINE(IA32_RT_SIGFRAME_sigcontext,
91                offsetof (struct rt_sigframe_ia32, uc.uc_mcontext));
92         BLANK();
93 #endif
94         DEFINE(pbe_address, offsetof(struct pbe, address));
95         DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
96         DEFINE(pbe_next, offsetof(struct pbe, next));
97         BLANK();
98 #define ENTRY(entry) DEFINE(pt_regs_ ## entry, offsetof(struct pt_regs, entry))
99         ENTRY(bx);
100         ENTRY(bx);
101         ENTRY(cx);
102         ENTRY(dx);
103         ENTRY(sp);
104         ENTRY(bp);
105         ENTRY(si);
106         ENTRY(di);
107         ENTRY(r8);
108         ENTRY(r9);
109         ENTRY(r10);
110         ENTRY(r11);
111         ENTRY(r12);
112         ENTRY(r13);
113         ENTRY(r14);
114         ENTRY(r15);
115         ENTRY(flags);
116         BLANK();
117 #undef ENTRY
118 #define ENTRY(entry) DEFINE(saved_context_ ## entry, offsetof(struct saved_context, entry))
119         ENTRY(cr0);
120         ENTRY(cr2);
121         ENTRY(cr3);
122         ENTRY(cr4);
123         ENTRY(cr8);
124         BLANK();
125 #undef ENTRY
126         DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist));
127         BLANK();
128         DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
129         BLANK();
130         DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
131
132         BLANK();
133         OFFSET(BP_scratch, boot_params, scratch);
134         OFFSET(BP_loadflags, boot_params, hdr.loadflags);
135         OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
136         OFFSET(BP_version, boot_params, hdr.version);
137
138         BLANK();
139         DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
140 #ifdef CONFIG_XEN
141         BLANK();
142         OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
143         OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
144 #undef ENTRY
145 #endif
146         return 0;
147 }