Merge branch 'upstream'
[pandora-kernel.git] / arch / x86_64 / kernel / asm-offsets.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/sched.h> 
8 #include <linux/stddef.h>
9 #include <linux/errno.h> 
10 #include <linux/hardirq.h>
11 #include <linux/suspend.h>
12 #include <asm/pda.h>
13 #include <asm/processor.h>
14 #include <asm/segment.h>
15 #include <asm/thread_info.h>
16 #include <asm/ia32.h>
17
18 #define DEFINE(sym, val) \
19         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
20
21 #define BLANK() asm volatile("\n->" : : )
22
23 int main(void)
24 {
25 #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
26         ENTRY(state);
27         ENTRY(flags); 
28         ENTRY(thread); 
29         ENTRY(pid);
30         BLANK();
31 #undef ENTRY
32 #define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
33         ENTRY(flags);
34         ENTRY(addr_limit);
35         ENTRY(preempt_count);
36         ENTRY(status);
37         BLANK();
38 #undef ENTRY
39 #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
40         ENTRY(kernelstack); 
41         ENTRY(oldrsp); 
42         ENTRY(pcurrent); 
43         ENTRY(irqcount);
44         ENTRY(cpunumber);
45         ENTRY(irqstackptr);
46         ENTRY(data_offset);
47         BLANK();
48 #undef ENTRY
49 #ifdef CONFIG_IA32_EMULATION
50 #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
51         ENTRY(eax);
52         ENTRY(ebx);
53         ENTRY(ecx);
54         ENTRY(edx);
55         ENTRY(esi);
56         ENTRY(edi);
57         ENTRY(ebp);
58         ENTRY(esp);
59         ENTRY(eip);
60         BLANK();
61 #undef ENTRY
62         DEFINE(IA32_RT_SIGFRAME_sigcontext,
63                offsetof (struct rt_sigframe32, uc.uc_mcontext));
64         BLANK();
65 #endif
66         DEFINE(pbe_address, offsetof(struct pbe, address));
67         DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
68         DEFINE(pbe_next, offsetof(struct pbe, next));
69         BLANK();
70         DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
71         return 0;
72 }