Merge HEAD from ../scsi-misc-2.6-tmp
[linux-2.6] / arch / ia64 / kernel / asm-offsets.c
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/config.h>
8
9 #include <linux/sched.h>
10
11 #include <asm-ia64/processor.h>
12 #include <asm-ia64/ptrace.h>
13 #include <asm-ia64/siginfo.h>
14 #include <asm-ia64/sigcontext.h>
15 #include <asm-ia64/mca.h>
16
17 #include "../kernel/sigframe.h"
18
19 #define DEFINE(sym, val) \
20         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21
22 #define BLANK() asm volatile("\n->" : : )
23
24 void foo(void)
25 {
26         DEFINE(IA64_TASK_SIZE, sizeof (struct task_struct));
27         DEFINE(IA64_THREAD_INFO_SIZE, sizeof (struct thread_info));
28         DEFINE(IA64_PT_REGS_SIZE, sizeof (struct pt_regs));
29         DEFINE(IA64_SWITCH_STACK_SIZE, sizeof (struct switch_stack));
30         DEFINE(IA64_SIGINFO_SIZE, sizeof (struct siginfo));
31         DEFINE(IA64_CPU_SIZE, sizeof (struct cpuinfo_ia64));
32         DEFINE(SIGFRAME_SIZE, sizeof (struct sigframe));
33         DEFINE(UNW_FRAME_INFO_SIZE, sizeof (struct unw_frame_info));
34
35         BLANK();
36
37         DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
38         DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
39
40         BLANK();
41
42         DEFINE(IA64_TASK_BLOCKED_OFFSET,offsetof (struct task_struct, blocked));
43         DEFINE(IA64_TASK_CLEAR_CHILD_TID_OFFSET,offsetof (struct task_struct, clear_child_tid));
44         DEFINE(IA64_TASK_GROUP_LEADER_OFFSET, offsetof (struct task_struct, group_leader));
45         DEFINE(IA64_TASK_PENDING_OFFSET,offsetof (struct task_struct, pending));
46         DEFINE(IA64_TASK_PID_OFFSET, offsetof (struct task_struct, pid));
47         DEFINE(IA64_TASK_REAL_PARENT_OFFSET, offsetof (struct task_struct, real_parent));
48         DEFINE(IA64_TASK_SIGHAND_OFFSET,offsetof (struct task_struct, sighand));
49         DEFINE(IA64_TASK_SIGNAL_OFFSET,offsetof (struct task_struct, signal));
50         DEFINE(IA64_TASK_TGID_OFFSET, offsetof (struct task_struct, tgid));
51         DEFINE(IA64_TASK_THREAD_KSP_OFFSET, offsetof (struct task_struct, thread.ksp));
52         DEFINE(IA64_TASK_THREAD_ON_USTACK_OFFSET, offsetof (struct task_struct, thread.on_ustack));
53
54         BLANK();
55
56         DEFINE(IA64_SIGHAND_SIGLOCK_OFFSET,offsetof (struct sighand_struct, siglock));
57
58         BLANK();
59
60         DEFINE(IA64_SIGNAL_GROUP_STOP_COUNT_OFFSET,offsetof (struct signal_struct,
61                                                              group_stop_count));
62         DEFINE(IA64_SIGNAL_SHARED_PENDING_OFFSET,offsetof (struct signal_struct, shared_pending));
63
64         BLANK();
65
66         DEFINE(IA64_PT_REGS_B6_OFFSET, offsetof (struct pt_regs, b6));
67         DEFINE(IA64_PT_REGS_B7_OFFSET, offsetof (struct pt_regs, b7));
68         DEFINE(IA64_PT_REGS_AR_CSD_OFFSET, offsetof (struct pt_regs, ar_csd));
69         DEFINE(IA64_PT_REGS_AR_SSD_OFFSET, offsetof (struct pt_regs, ar_ssd));
70         DEFINE(IA64_PT_REGS_R8_OFFSET, offsetof (struct pt_regs, r8));
71         DEFINE(IA64_PT_REGS_R9_OFFSET, offsetof (struct pt_regs, r9));
72         DEFINE(IA64_PT_REGS_R10_OFFSET, offsetof (struct pt_regs, r10));
73         DEFINE(IA64_PT_REGS_R11_OFFSET, offsetof (struct pt_regs, r11));
74         DEFINE(IA64_PT_REGS_CR_IPSR_OFFSET, offsetof (struct pt_regs, cr_ipsr));
75         DEFINE(IA64_PT_REGS_CR_IIP_OFFSET, offsetof (struct pt_regs, cr_iip));
76         DEFINE(IA64_PT_REGS_CR_IFS_OFFSET, offsetof (struct pt_regs, cr_ifs));
77         DEFINE(IA64_PT_REGS_AR_UNAT_OFFSET, offsetof (struct pt_regs, ar_unat));
78         DEFINE(IA64_PT_REGS_AR_PFS_OFFSET, offsetof (struct pt_regs, ar_pfs));
79         DEFINE(IA64_PT_REGS_AR_RSC_OFFSET, offsetof (struct pt_regs, ar_rsc));
80         DEFINE(IA64_PT_REGS_AR_RNAT_OFFSET, offsetof (struct pt_regs, ar_rnat));
81
82         DEFINE(IA64_PT_REGS_AR_BSPSTORE_OFFSET, offsetof (struct pt_regs, ar_bspstore));
83         DEFINE(IA64_PT_REGS_PR_OFFSET, offsetof (struct pt_regs, pr));
84         DEFINE(IA64_PT_REGS_B0_OFFSET, offsetof (struct pt_regs, b0));
85         DEFINE(IA64_PT_REGS_LOADRS_OFFSET, offsetof (struct pt_regs, loadrs));
86         DEFINE(IA64_PT_REGS_R1_OFFSET, offsetof (struct pt_regs, r1));
87         DEFINE(IA64_PT_REGS_R12_OFFSET, offsetof (struct pt_regs, r12));
88         DEFINE(IA64_PT_REGS_R13_OFFSET, offsetof (struct pt_regs, r13));
89         DEFINE(IA64_PT_REGS_AR_FPSR_OFFSET, offsetof (struct pt_regs, ar_fpsr));
90         DEFINE(IA64_PT_REGS_R15_OFFSET, offsetof (struct pt_regs, r15));
91         DEFINE(IA64_PT_REGS_R14_OFFSET, offsetof (struct pt_regs, r14));
92         DEFINE(IA64_PT_REGS_R2_OFFSET, offsetof (struct pt_regs, r2));
93         DEFINE(IA64_PT_REGS_R3_OFFSET, offsetof (struct pt_regs, r3));
94         DEFINE(IA64_PT_REGS_R16_OFFSET, offsetof (struct pt_regs, r16));
95         DEFINE(IA64_PT_REGS_R17_OFFSET, offsetof (struct pt_regs, r17));
96         DEFINE(IA64_PT_REGS_R18_OFFSET, offsetof (struct pt_regs, r18));
97         DEFINE(IA64_PT_REGS_R19_OFFSET, offsetof (struct pt_regs, r19));
98         DEFINE(IA64_PT_REGS_R20_OFFSET, offsetof (struct pt_regs, r20));
99         DEFINE(IA64_PT_REGS_R21_OFFSET, offsetof (struct pt_regs, r21));
100         DEFINE(IA64_PT_REGS_R22_OFFSET, offsetof (struct pt_regs, r22));
101         DEFINE(IA64_PT_REGS_R23_OFFSET, offsetof (struct pt_regs, r23));
102         DEFINE(IA64_PT_REGS_R24_OFFSET, offsetof (struct pt_regs, r24));
103         DEFINE(IA64_PT_REGS_R25_OFFSET, offsetof (struct pt_regs, r25));
104         DEFINE(IA64_PT_REGS_R26_OFFSET, offsetof (struct pt_regs, r26));
105         DEFINE(IA64_PT_REGS_R27_OFFSET, offsetof (struct pt_regs, r27));
106         DEFINE(IA64_PT_REGS_R28_OFFSET, offsetof (struct pt_regs, r28));
107         DEFINE(IA64_PT_REGS_R29_OFFSET, offsetof (struct pt_regs, r29));
108         DEFINE(IA64_PT_REGS_R30_OFFSET, offsetof (struct pt_regs, r30));
109         DEFINE(IA64_PT_REGS_R31_OFFSET, offsetof (struct pt_regs, r31));
110         DEFINE(IA64_PT_REGS_AR_CCV_OFFSET, offsetof (struct pt_regs, ar_ccv));
111         DEFINE(IA64_PT_REGS_F6_OFFSET, offsetof (struct pt_regs, f6));
112         DEFINE(IA64_PT_REGS_F7_OFFSET, offsetof (struct pt_regs, f7));
113         DEFINE(IA64_PT_REGS_F8_OFFSET, offsetof (struct pt_regs, f8));
114         DEFINE(IA64_PT_REGS_F9_OFFSET, offsetof (struct pt_regs, f9));
115         DEFINE(IA64_PT_REGS_F10_OFFSET, offsetof (struct pt_regs, f10));
116         DEFINE(IA64_PT_REGS_F11_OFFSET, offsetof (struct pt_regs, f11));
117
118         BLANK();
119
120         DEFINE(IA64_SWITCH_STACK_CALLER_UNAT_OFFSET, offsetof (struct switch_stack, caller_unat));
121         DEFINE(IA64_SWITCH_STACK_AR_FPSR_OFFSET, offsetof (struct switch_stack, ar_fpsr));
122         DEFINE(IA64_SWITCH_STACK_F2_OFFSET, offsetof (struct switch_stack, f2));
123         DEFINE(IA64_SWITCH_STACK_F3_OFFSET, offsetof (struct switch_stack, f3));
124         DEFINE(IA64_SWITCH_STACK_F4_OFFSET, offsetof (struct switch_stack, f4));
125         DEFINE(IA64_SWITCH_STACK_F5_OFFSET, offsetof (struct switch_stack, f5));
126         DEFINE(IA64_SWITCH_STACK_F12_OFFSET, offsetof (struct switch_stack, f12));
127         DEFINE(IA64_SWITCH_STACK_F13_OFFSET, offsetof (struct switch_stack, f13));
128         DEFINE(IA64_SWITCH_STACK_F14_OFFSET, offsetof (struct switch_stack, f14));
129         DEFINE(IA64_SWITCH_STACK_F15_OFFSET, offsetof (struct switch_stack, f15));
130         DEFINE(IA64_SWITCH_STACK_F16_OFFSET, offsetof (struct switch_stack, f16));
131         DEFINE(IA64_SWITCH_STACK_F17_OFFSET, offsetof (struct switch_stack, f17));
132         DEFINE(IA64_SWITCH_STACK_F18_OFFSET, offsetof (struct switch_stack, f18));
133         DEFINE(IA64_SWITCH_STACK_F19_OFFSET, offsetof (struct switch_stack, f19));
134         DEFINE(IA64_SWITCH_STACK_F20_OFFSET, offsetof (struct switch_stack, f20));
135         DEFINE(IA64_SWITCH_STACK_F21_OFFSET, offsetof (struct switch_stack, f21));
136         DEFINE(IA64_SWITCH_STACK_F22_OFFSET, offsetof (struct switch_stack, f22));
137         DEFINE(IA64_SWITCH_STACK_F23_OFFSET, offsetof (struct switch_stack, f23));
138         DEFINE(IA64_SWITCH_STACK_F24_OFFSET, offsetof (struct switch_stack, f24));
139         DEFINE(IA64_SWITCH_STACK_F25_OFFSET, offsetof (struct switch_stack, f25));
140         DEFINE(IA64_SWITCH_STACK_F26_OFFSET, offsetof (struct switch_stack, f26));
141         DEFINE(IA64_SWITCH_STACK_F27_OFFSET, offsetof (struct switch_stack, f27));
142         DEFINE(IA64_SWITCH_STACK_F28_OFFSET, offsetof (struct switch_stack, f28));
143         DEFINE(IA64_SWITCH_STACK_F29_OFFSET, offsetof (struct switch_stack, f29));
144         DEFINE(IA64_SWITCH_STACK_F30_OFFSET, offsetof (struct switch_stack, f30));
145         DEFINE(IA64_SWITCH_STACK_F31_OFFSET, offsetof (struct switch_stack, f31));
146         DEFINE(IA64_SWITCH_STACK_R4_OFFSET, offsetof (struct switch_stack, r4));
147         DEFINE(IA64_SWITCH_STACK_R5_OFFSET, offsetof (struct switch_stack, r5));
148         DEFINE(IA64_SWITCH_STACK_R6_OFFSET, offsetof (struct switch_stack, r6));
149         DEFINE(IA64_SWITCH_STACK_R7_OFFSET, offsetof (struct switch_stack, r7));
150         DEFINE(IA64_SWITCH_STACK_B0_OFFSET, offsetof (struct switch_stack, b0));
151         DEFINE(IA64_SWITCH_STACK_B1_OFFSET, offsetof (struct switch_stack, b1));
152         DEFINE(IA64_SWITCH_STACK_B2_OFFSET, offsetof (struct switch_stack, b2));
153         DEFINE(IA64_SWITCH_STACK_B3_OFFSET, offsetof (struct switch_stack, b3));
154         DEFINE(IA64_SWITCH_STACK_B4_OFFSET, offsetof (struct switch_stack, b4));
155         DEFINE(IA64_SWITCH_STACK_B5_OFFSET, offsetof (struct switch_stack, b5));
156         DEFINE(IA64_SWITCH_STACK_AR_PFS_OFFSET, offsetof (struct switch_stack, ar_pfs));
157         DEFINE(IA64_SWITCH_STACK_AR_LC_OFFSET, offsetof (struct switch_stack, ar_lc));
158         DEFINE(IA64_SWITCH_STACK_AR_UNAT_OFFSET, offsetof (struct switch_stack, ar_unat));
159         DEFINE(IA64_SWITCH_STACK_AR_RNAT_OFFSET, offsetof (struct switch_stack, ar_rnat));
160         DEFINE(IA64_SWITCH_STACK_AR_BSPSTORE_OFFSET, offsetof (struct switch_stack, ar_bspstore));
161         DEFINE(IA64_SWITCH_STACK_PR_OFFSET, offsetof (struct switch_stack, pr));
162
163         BLANK();
164
165         DEFINE(IA64_SIGCONTEXT_IP_OFFSET, offsetof (struct sigcontext, sc_ip));
166         DEFINE(IA64_SIGCONTEXT_AR_BSP_OFFSET, offsetof (struct sigcontext, sc_ar_bsp));
167         DEFINE(IA64_SIGCONTEXT_AR_FPSR_OFFSET, offsetof (struct sigcontext, sc_ar_fpsr));
168         DEFINE(IA64_SIGCONTEXT_AR_RNAT_OFFSET, offsetof (struct sigcontext, sc_ar_rnat));
169         DEFINE(IA64_SIGCONTEXT_AR_UNAT_OFFSET, offsetof (struct sigcontext, sc_ar_unat));
170         DEFINE(IA64_SIGCONTEXT_B0_OFFSET, offsetof (struct sigcontext, sc_br[0]));
171         DEFINE(IA64_SIGCONTEXT_CFM_OFFSET, offsetof (struct sigcontext, sc_cfm));
172         DEFINE(IA64_SIGCONTEXT_FLAGS_OFFSET, offsetof (struct sigcontext, sc_flags));
173         DEFINE(IA64_SIGCONTEXT_FR6_OFFSET, offsetof (struct sigcontext, sc_fr[6]));
174         DEFINE(IA64_SIGCONTEXT_PR_OFFSET, offsetof (struct sigcontext, sc_pr));
175         DEFINE(IA64_SIGCONTEXT_R12_OFFSET, offsetof (struct sigcontext, sc_gr[12]));
176         DEFINE(IA64_SIGCONTEXT_RBS_BASE_OFFSET,offsetof (struct sigcontext, sc_rbs_base));
177         DEFINE(IA64_SIGCONTEXT_LOADRS_OFFSET, offsetof (struct sigcontext, sc_loadrs));
178
179         BLANK();
180
181         DEFINE(IA64_SIGPENDING_SIGNAL_OFFSET, offsetof (struct sigpending, signal));
182
183         BLANK();
184
185         DEFINE(IA64_SIGFRAME_ARG0_OFFSET, offsetof (struct sigframe, arg0));
186         DEFINE(IA64_SIGFRAME_ARG1_OFFSET, offsetof (struct sigframe, arg1));
187         DEFINE(IA64_SIGFRAME_ARG2_OFFSET, offsetof (struct sigframe, arg2));
188         DEFINE(IA64_SIGFRAME_HANDLER_OFFSET, offsetof (struct sigframe, handler));
189         DEFINE(IA64_SIGFRAME_SIGCONTEXT_OFFSET, offsetof (struct sigframe, sc));
190         BLANK();
191     /* for assembly files which can't include sched.h: */
192         DEFINE(IA64_CLONE_VFORK, CLONE_VFORK);
193         DEFINE(IA64_CLONE_VM, CLONE_VM);
194
195         BLANK();
196         DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET,
197                offsetof (struct cpuinfo_ia64, nsec_per_cyc));
198         DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET,
199                offsetof (struct cpuinfo_ia64, ptce_base));
200         DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET,
201                offsetof (struct cpuinfo_ia64, ptce_count));
202         DEFINE(IA64_CPUINFO_PTCE_STRIDE_OFFSET,
203                offsetof (struct cpuinfo_ia64, ptce_stride));
204         BLANK();
205         DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET,
206                offsetof (struct timespec, tv_nsec));
207
208         DEFINE(CLONE_SETTLS_BIT, 19);
209 #if CLONE_SETTLS != (1<<19)
210 # error "CLONE_SETTLS_BIT incorrect, please fix"
211 #endif
212
213         BLANK();
214         DEFINE(IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET,
215                offsetof (struct ia64_mca_cpu, proc_state_dump));
216         DEFINE(IA64_MCA_CPU_STACK_OFFSET,
217                offsetof (struct ia64_mca_cpu, stack));
218         DEFINE(IA64_MCA_CPU_STACKFRAME_OFFSET,
219                offsetof (struct ia64_mca_cpu, stackframe));
220         DEFINE(IA64_MCA_CPU_RBSTORE_OFFSET,
221                offsetof (struct ia64_mca_cpu, rbstore));
222         DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET,
223                offsetof (struct ia64_mca_cpu, init_stack));
224         BLANK();
225         /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */
226         DEFINE(IA64_TIME_INTERPOLATOR_ADDRESS_OFFSET, offsetof (struct time_interpolator, addr));
227         DEFINE(IA64_TIME_INTERPOLATOR_SOURCE_OFFSET, offsetof (struct time_interpolator, source));
228         DEFINE(IA64_TIME_INTERPOLATOR_SHIFT_OFFSET, offsetof (struct time_interpolator, shift));
229         DEFINE(IA64_TIME_INTERPOLATOR_NSEC_OFFSET, offsetof (struct time_interpolator, nsec_per_cyc));
230         DEFINE(IA64_TIME_INTERPOLATOR_OFFSET_OFFSET, offsetof (struct time_interpolator, offset));
231         DEFINE(IA64_TIME_INTERPOLATOR_LAST_CYCLE_OFFSET, offsetof (struct time_interpolator, last_cycle));
232         DEFINE(IA64_TIME_INTERPOLATOR_LAST_COUNTER_OFFSET, offsetof (struct time_interpolator, last_counter));
233         DEFINE(IA64_TIME_INTERPOLATOR_JITTER_OFFSET, offsetof (struct time_interpolator, jitter));
234         DEFINE(IA64_TIME_INTERPOLATOR_MASK_OFFSET, offsetof (struct time_interpolator, mask));
235         DEFINE(IA64_TIME_SOURCE_CPU, TIME_SOURCE_CPU);
236         DEFINE(IA64_TIME_SOURCE_MMIO64, TIME_SOURCE_MMIO64);
237         DEFINE(IA64_TIME_SOURCE_MMIO32, TIME_SOURCE_MMIO32);
238         DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET, offsetof (struct timespec, tv_nsec));
239 }