ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.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 <asm/pda.h>
11 #include <asm/hardirq.h>
12 #include <asm/processor.h>
13 #include <asm/segment.h>
14 #include <asm/thread_info.h>
15 #include <asm/ia32.h>
16
17 #define DEFINE(sym, val) \
18         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
19
20 #define BLANK() asm volatile("\n->" : : )
21
22 int main(void)
23 {
24 #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
25         ENTRY(state);
26         ENTRY(flags); 
27         ENTRY(thread); 
28         ENTRY(pid);
29         BLANK();
30 #undef ENTRY
31 #define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
32         ENTRY(flags);
33         ENTRY(addr_limit);
34         ENTRY(preempt_count);
35         BLANK();
36 #undef ENTRY
37 #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
38         ENTRY(kernelstack); 
39         ENTRY(oldrsp); 
40         ENTRY(pcurrent); 
41         ENTRY(irqrsp);
42         ENTRY(irqcount);
43         ENTRY(cpunumber);
44         ENTRY(irqstackptr);
45         BLANK();
46 #undef ENTRY
47 #ifdef CONFIG_IA32_EMULATION
48 #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
49         ENTRY(eax);
50         ENTRY(ebx);
51         ENTRY(ecx);
52         ENTRY(edx);
53         ENTRY(esi);
54         ENTRY(edi);
55         ENTRY(ebp);
56         ENTRY(esp);
57         ENTRY(eip);
58         BLANK();
59 #undef ENTRY
60         DEFINE(IA32_RT_SIGFRAME_sigcontext,
61                offsetof (struct rt_sigframe32, uc.uc_mcontext));
62         BLANK();
63 #endif
64
65         return 0;
66 }