Merge branch 'x86-asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / arch / powerpc / kernel / asm-offsets.c
1 /*
2  * This program is used to generate definitions needed by
3  * assembly language modules.
4  *
5  * We use the technique used in the OSF Mach kernel code:
6  * generate asm statements containing #defines,
7  * compile this file to assembler, and then extract the
8  * #defines from the assembly-language output.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version
13  * 2 of the License, or (at your option) any later version.
14  */
15
16 #include <linux/signal.h>
17 #include <linux/sched.h>
18 #include <linux/kernel.h>
19 #include <linux/errno.h>
20 #include <linux/string.h>
21 #include <linux/types.h>
22 #include <linux/mman.h>
23 #include <linux/mm.h>
24 #include <linux/suspend.h>
25 #include <linux/hrtimer.h>
26 #ifdef CONFIG_PPC64
27 #include <linux/time.h>
28 #include <linux/hardirq.h>
29 #endif
30 #include <linux/kbuild.h>
31
32 #include <asm/io.h>
33 #include <asm/page.h>
34 #include <asm/pgtable.h>
35 #include <asm/processor.h>
36 #include <asm/cputable.h>
37 #include <asm/thread_info.h>
38 #include <asm/rtas.h>
39 #include <asm/vdso_datapage.h>
40 #ifdef CONFIG_PPC64
41 #include <asm/paca.h>
42 #include <asm/lppaca.h>
43 #include <asm/cache.h>
44 #include <asm/compat.h>
45 #include <asm/mmu.h>
46 #include <asm/hvcall.h>
47 #endif
48 #ifdef CONFIG_PPC_ISERIES
49 #include <asm/iseries/alpaca.h>
50 #endif
51 #ifdef CONFIG_KVM
52 #include <linux/kvm_host.h>
53 #endif
54
55 #if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
56 #include "head_booke.h"
57 #endif
58
59 #if defined(CONFIG_FSL_BOOKE)
60 #include "../mm/mmu_decl.h"
61 #endif
62
63 int main(void)
64 {
65         DEFINE(THREAD, offsetof(struct task_struct, thread));
66         DEFINE(MM, offsetof(struct task_struct, mm));
67         DEFINE(MMCONTEXTID, offsetof(struct mm_struct, context.id));
68 #ifdef CONFIG_PPC64
69         DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context));
70         DEFINE(SIGSEGV, SIGSEGV);
71         DEFINE(NMI_MASK, NMI_MASK);
72 #else
73         DEFINE(THREAD_INFO, offsetof(struct task_struct, stack));
74 #endif /* CONFIG_PPC64 */
75
76         DEFINE(KSP, offsetof(struct thread_struct, ksp));
77         DEFINE(KSP_LIMIT, offsetof(struct thread_struct, ksp_limit));
78         DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
79         DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
80         DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0]));
81         DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr));
82 #ifdef CONFIG_ALTIVEC
83         DEFINE(THREAD_VR0, offsetof(struct thread_struct, vr[0]));
84         DEFINE(THREAD_VRSAVE, offsetof(struct thread_struct, vrsave));
85         DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
86         DEFINE(THREAD_USED_VR, offsetof(struct thread_struct, used_vr));
87 #endif /* CONFIG_ALTIVEC */
88 #ifdef CONFIG_VSX
89         DEFINE(THREAD_VSR0, offsetof(struct thread_struct, fpr));
90         DEFINE(THREAD_USED_VSR, offsetof(struct thread_struct, used_vsr));
91 #endif /* CONFIG_VSX */
92 #ifdef CONFIG_PPC64
93         DEFINE(KSP_VSID, offsetof(struct thread_struct, ksp_vsid));
94 #else /* CONFIG_PPC64 */
95         DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
96 #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
97         DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
98 #endif
99 #ifdef CONFIG_SPE
100         DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0]));
101         DEFINE(THREAD_ACC, offsetof(struct thread_struct, acc));
102         DEFINE(THREAD_SPEFSCR, offsetof(struct thread_struct, spefscr));
103         DEFINE(THREAD_USED_SPE, offsetof(struct thread_struct, used_spe));
104 #endif /* CONFIG_SPE */
105 #endif /* CONFIG_PPC64 */
106
107         DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
108         DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
109         DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
110         DEFINE(TI_TASK, offsetof(struct thread_info, task));
111         DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
112
113 #ifdef CONFIG_PPC64
114         DEFINE(DCACHEL1LINESIZE, offsetof(struct ppc64_caches, dline_size));
115         DEFINE(DCACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_dline_size));
116         DEFINE(DCACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, dlines_per_page));
117         DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size));
118         DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size));
119         DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page));
120         /* paca */
121         DEFINE(PACA_SIZE, sizeof(struct paca_struct));
122         DEFINE(PACAPACAINDEX, offsetof(struct paca_struct, paca_index));
123         DEFINE(PACAPROCSTART, offsetof(struct paca_struct, cpu_start));
124         DEFINE(PACAKSAVE, offsetof(struct paca_struct, kstack));
125         DEFINE(PACACURRENT, offsetof(struct paca_struct, __current));
126         DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, saved_msr));
127         DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr));
128         DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1));
129         DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc));
130         DEFINE(PACAKBASE, offsetof(struct paca_struct, kernelbase));
131         DEFINE(PACAKMSR, offsetof(struct paca_struct, kernel_msr));
132         DEFINE(PACASOFTIRQEN, offsetof(struct paca_struct, soft_enabled));
133         DEFINE(PACAHARDIRQEN, offsetof(struct paca_struct, hard_enabled));
134         DEFINE(PACAPERFPEND, offsetof(struct paca_struct, perf_counter_pending));
135         DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
136 #ifdef CONFIG_PPC_MM_SLICES
137         DEFINE(PACALOWSLICESPSIZE, offsetof(struct paca_struct,
138                                             context.low_slices_psize));
139         DEFINE(PACAHIGHSLICEPSIZE, offsetof(struct paca_struct,
140                                             context.high_slices_psize));
141         DEFINE(MMUPSIZEDEFSIZE, sizeof(struct mmu_psize_def));
142 #endif /* CONFIG_PPC_MM_SLICES */
143 #ifdef CONFIG_PPC_STD_MMU_64
144         DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real));
145         DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr));
146         DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache));
147         DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr));
148         DEFINE(PACAVMALLOCSLLP, offsetof(struct paca_struct, vmalloc_sllp));
149 #ifdef CONFIG_PPC_MM_SLICES
150         DEFINE(MMUPSIZESLLP, offsetof(struct mmu_psize_def, sllp));
151 #else
152         DEFINE(PACACONTEXTSLLP, offsetof(struct paca_struct, context.sllp));
153 #endif /* CONFIG_PPC_MM_SLICES */
154         DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen));
155         DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc));
156         DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb));
157         DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
158         DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
159         DEFINE(SLBSHADOW_STACKVSID,
160                offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid));
161         DEFINE(SLBSHADOW_STACKESID,
162                offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].esid));
163         DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
164         DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1));
165         DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int));
166         DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int));
167         DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area));
168 #endif /* CONFIG_PPC_STD_MMU_64 */
169         DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
170         DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
171         DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
172         DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
173         DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
174         DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
175         DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
176         DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
177 #endif /* CONFIG_PPC64 */
178
179         /* RTAS */
180         DEFINE(RTASBASE, offsetof(struct rtas_t, base));
181         DEFINE(RTASENTRY, offsetof(struct rtas_t, entry));
182
183         /* Interrupt register frame */
184         DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
185         DEFINE(INT_FRAME_SIZE, STACK_INT_FRAME_SIZE);
186 #ifdef CONFIG_PPC64
187         DEFINE(SWITCH_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
188         /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */
189         DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16);
190         DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16);
191
192         /* hcall statistics */
193         DEFINE(HCALL_STAT_SIZE, sizeof(struct hcall_stats));
194         DEFINE(HCALL_STAT_CALLS, offsetof(struct hcall_stats, num_calls));
195         DEFINE(HCALL_STAT_TB, offsetof(struct hcall_stats, tb_total));
196         DEFINE(HCALL_STAT_PURR, offsetof(struct hcall_stats, purr_total));
197 #endif /* CONFIG_PPC64 */
198         DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0]));
199         DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1]));
200         DEFINE(GPR2, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[2]));
201         DEFINE(GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[3]));
202         DEFINE(GPR4, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[4]));
203         DEFINE(GPR5, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[5]));
204         DEFINE(GPR6, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[6]));
205         DEFINE(GPR7, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[7]));
206         DEFINE(GPR8, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[8]));
207         DEFINE(GPR9, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[9]));
208         DEFINE(GPR10, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[10]));
209         DEFINE(GPR11, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[11]));
210         DEFINE(GPR12, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[12]));
211         DEFINE(GPR13, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[13]));
212 #ifndef CONFIG_PPC64
213         DEFINE(GPR14, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[14]));
214         DEFINE(GPR15, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[15]));
215         DEFINE(GPR16, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[16]));
216         DEFINE(GPR17, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[17]));
217         DEFINE(GPR18, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[18]));
218         DEFINE(GPR19, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[19]));
219         DEFINE(GPR20, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[20]));
220         DEFINE(GPR21, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[21]));
221         DEFINE(GPR22, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[22]));
222         DEFINE(GPR23, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[23]));
223         DEFINE(GPR24, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[24]));
224         DEFINE(GPR25, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[25]));
225         DEFINE(GPR26, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[26]));
226         DEFINE(GPR27, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[27]));
227         DEFINE(GPR28, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[28]));
228         DEFINE(GPR29, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[29]));
229         DEFINE(GPR30, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[30]));
230         DEFINE(GPR31, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[31]));
231 #endif /* CONFIG_PPC64 */
232         /*
233          * Note: these symbols include _ because they overlap with special
234          * register names
235          */
236         DEFINE(_NIP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, nip));
237         DEFINE(_MSR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, msr));
238         DEFINE(_CTR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ctr));
239         DEFINE(_LINK, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, link));
240         DEFINE(_CCR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ccr));
241         DEFINE(_XER, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, xer));
242         DEFINE(_DAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
243         DEFINE(_DSISR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
244         DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3));
245         DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result));
246         DEFINE(_TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
247 #ifndef CONFIG_PPC64
248         DEFINE(_MQ, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, mq));
249         /*
250          * The PowerPC 400-class & Book-E processors have neither the DAR
251          * nor the DSISR SPRs. Hence, we overload them to hold the similar
252          * DEAR and ESR SPRs for such processors.  For critical interrupts
253          * we use them to hold SRR0 and SRR1.
254          */
255         DEFINE(_DEAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
256         DEFINE(_ESR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
257 #else /* CONFIG_PPC64 */
258         DEFINE(SOFTE, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, softe));
259
260         /* These _only_ to be used with {PROM,RTAS}_FRAME_SIZE!!! */
261         DEFINE(_SRR0, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs));
262         DEFINE(_SRR1, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs)+8);
263 #endif /* CONFIG_PPC64 */
264
265 #if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
266         DEFINE(EXC_LVL_SIZE, STACK_EXC_LVL_FRAME_SIZE);
267         DEFINE(MAS0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas0));
268         /* we overload MMUCR for 44x on MAS0 since they are mutually exclusive */
269         DEFINE(MMUCR, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas0));
270         DEFINE(MAS1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas1));
271         DEFINE(MAS2, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas2));
272         DEFINE(MAS3, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas3));
273         DEFINE(MAS6, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas6));
274         DEFINE(MAS7, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas7));
275         DEFINE(_SRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, srr0));
276         DEFINE(_SRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, srr1));
277         DEFINE(_CSRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, csrr0));
278         DEFINE(_CSRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, csrr1));
279         DEFINE(_DSRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, dsrr0));
280         DEFINE(_DSRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, dsrr1));
281         DEFINE(SAVED_KSP_LIMIT, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, saved_ksp_limit));
282 #endif
283
284         DEFINE(CLONE_VM, CLONE_VM);
285         DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
286
287 #ifndef CONFIG_PPC64
288         DEFINE(MM_PGD, offsetof(struct mm_struct, pgd));
289 #endif /* ! CONFIG_PPC64 */
290
291         /* About the CPU features table */
292         DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
293         DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
294         DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
295
296         DEFINE(pbe_address, offsetof(struct pbe, address));
297         DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
298         DEFINE(pbe_next, offsetof(struct pbe, next));
299
300 #ifndef CONFIG_PPC64
301         DEFINE(TASK_SIZE, TASK_SIZE);
302         DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
303 #endif /* ! CONFIG_PPC64 */
304
305         /* datapage offsets for use by vdso */
306         DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct vdso_data, tb_orig_stamp));
307         DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct vdso_data, tb_ticks_per_sec));
308         DEFINE(CFG_TB_TO_XS, offsetof(struct vdso_data, tb_to_xs));
309         DEFINE(CFG_STAMP_XSEC, offsetof(struct vdso_data, stamp_xsec));
310         DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct vdso_data, tb_update_count));
311         DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct vdso_data, tz_minuteswest));
312         DEFINE(CFG_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime));
313         DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32));
314         DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
315         DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
316         DEFINE(STAMP_XTIME, offsetof(struct vdso_data, stamp_xtime));
317         DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size));
318         DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size));
319         DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size));
320         DEFINE(CFG_DCACHE_LOGBLOCKSZ, offsetof(struct vdso_data, dcache_log_block_size));
321 #ifdef CONFIG_PPC64
322         DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64));
323         DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec));
324         DEFINE(TVAL64_TV_USEC, offsetof(struct timeval, tv_usec));
325         DEFINE(TVAL32_TV_SEC, offsetof(struct compat_timeval, tv_sec));
326         DEFINE(TVAL32_TV_USEC, offsetof(struct compat_timeval, tv_usec));
327         DEFINE(TSPC64_TV_SEC, offsetof(struct timespec, tv_sec));
328         DEFINE(TSPC64_TV_NSEC, offsetof(struct timespec, tv_nsec));
329         DEFINE(TSPC32_TV_SEC, offsetof(struct compat_timespec, tv_sec));
330         DEFINE(TSPC32_TV_NSEC, offsetof(struct compat_timespec, tv_nsec));
331 #else
332         DEFINE(TVAL32_TV_SEC, offsetof(struct timeval, tv_sec));
333         DEFINE(TVAL32_TV_USEC, offsetof(struct timeval, tv_usec));
334         DEFINE(TSPC32_TV_SEC, offsetof(struct timespec, tv_sec));
335         DEFINE(TSPC32_TV_NSEC, offsetof(struct timespec, tv_nsec));
336 #endif
337         /* timeval/timezone offsets for use by vdso */
338         DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
339         DEFINE(TZONE_TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
340
341         /* Other bits used by the vdso */
342         DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
343         DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
344         DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
345         DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
346
347 #ifdef CONFIG_BUG
348         DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));
349 #endif
350
351 #ifdef CONFIG_PPC_ISERIES
352         /* the assembler miscalculates the VSID values */
353         DEFINE(PAGE_OFFSET_ESID, GET_ESID(PAGE_OFFSET));
354         DEFINE(PAGE_OFFSET_VSID, KERNEL_VSID(PAGE_OFFSET));
355         DEFINE(VMALLOC_START_ESID, GET_ESID(VMALLOC_START));
356         DEFINE(VMALLOC_START_VSID, KERNEL_VSID(VMALLOC_START));
357
358         /* alpaca */
359         DEFINE(ALPACA_SIZE, sizeof(struct alpaca));
360 #endif
361
362         DEFINE(PGD_TABLE_SIZE, PGD_TABLE_SIZE);
363         DEFINE(PTE_SIZE, sizeof(pte_t));
364
365 #ifdef CONFIG_KVM
366         DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, arch.host_stack));
367         DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, arch.host_pid));
368         DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr));
369         DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr));
370         DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr));
371         DEFINE(VCPU_XER, offsetof(struct kvm_vcpu, arch.xer));
372         DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr));
373         DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc));
374         DEFINE(VCPU_MSR, offsetof(struct kvm_vcpu, arch.msr));
375         DEFINE(VCPU_SPRG4, offsetof(struct kvm_vcpu, arch.sprg4));
376         DEFINE(VCPU_SPRG5, offsetof(struct kvm_vcpu, arch.sprg5));
377         DEFINE(VCPU_SPRG6, offsetof(struct kvm_vcpu, arch.sprg6));
378         DEFINE(VCPU_SPRG7, offsetof(struct kvm_vcpu, arch.sprg7));
379         DEFINE(VCPU_SHADOW_PID, offsetof(struct kvm_vcpu, arch.shadow_pid));
380
381         DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
382         DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
383         DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
384 #endif
385 #ifdef CONFIG_44x
386         DEFINE(PGD_T_LOG2, PGD_T_LOG2);
387         DEFINE(PTE_T_LOG2, PTE_T_LOG2);
388 #endif
389 #ifdef CONFIG_FSL_BOOKE
390         DEFINE(TLBCAM_SIZE, sizeof(struct tlbcam));
391 #endif
392
393 #ifdef CONFIG_KVM_EXIT_TIMING
394         DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu,
395                                                 arch.timing_exit.tv32.tbu));
396         DEFINE(VCPU_TIMING_EXIT_TBL, offsetof(struct kvm_vcpu,
397                                                 arch.timing_exit.tv32.tbl));
398         DEFINE(VCPU_TIMING_LAST_ENTER_TBU, offsetof(struct kvm_vcpu,
399                                         arch.timing_last_enter.tv32.tbu));
400         DEFINE(VCPU_TIMING_LAST_ENTER_TBL, offsetof(struct kvm_vcpu,
401                                         arch.timing_last_enter.tv32.tbl));
402 #endif
403
404         return 0;
405 }