x86: add PAGE_KERNEL_EXEC_NOCACHE
[wrt350n-kernel.git] / arch / ppc / kernel / asm-offsets.c
blobe8e94321b59e6fd653188c40078a6239cb8146a2
1 /*
2 * This program is used to generate definitions needed by
3 * assembly language modules.
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 */
11 #include <linux/signal.h>
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/errno.h>
15 #include <linux/string.h>
16 #include <linux/types.h>
17 #include <linux/ptrace.h>
18 #include <linux/suspend.h>
19 #include <linux/mman.h>
20 #include <linux/mm.h>
21 #include <asm/io.h>
22 #include <asm/page.h>
23 #include <asm/pgtable.h>
24 #include <asm/processor.h>
25 #include <asm/cputable.h>
26 #include <asm/thread_info.h>
27 #include <asm/vdso_datapage.h>
29 #define DEFINE(sym, val) \
30 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
32 #define BLANK() asm volatile("\n->" : : )
34 int
35 main(void)
37 DEFINE(THREAD, offsetof(struct task_struct, thread));
38 DEFINE(THREAD_INFO, offsetof(struct task_struct, stack));
39 DEFINE(MM, offsetof(struct task_struct, mm));
40 DEFINE(PTRACE, offsetof(struct task_struct, ptrace));
41 DEFINE(KSP, offsetof(struct thread_struct, ksp));
42 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
43 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
44 DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
45 DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0]));
46 DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr));
47 #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
48 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
49 DEFINE(PT_PTRACED, PT_PTRACED);
50 #endif
51 #ifdef CONFIG_ALTIVEC
52 DEFINE(THREAD_VR0, offsetof(struct thread_struct, vr[0]));
53 DEFINE(THREAD_VRSAVE, offsetof(struct thread_struct, vrsave));
54 DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
55 DEFINE(THREAD_USED_VR, offsetof(struct thread_struct, used_vr));
56 #endif /* CONFIG_ALTIVEC */
57 #ifdef CONFIG_SPE
58 DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0]));
59 DEFINE(THREAD_ACC, offsetof(struct thread_struct, acc));
60 DEFINE(THREAD_SPEFSCR, offsetof(struct thread_struct, spefscr));
61 DEFINE(THREAD_USED_SPE, offsetof(struct thread_struct, used_spe));
62 #endif /* CONFIG_SPE */
63 /* Interrupt register frame */
64 DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
65 DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
66 /* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
67 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0]));
68 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1]));
69 DEFINE(GPR2, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[2]));
70 DEFINE(GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[3]));
71 DEFINE(GPR4, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[4]));
72 DEFINE(GPR5, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[5]));
73 DEFINE(GPR6, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[6]));
74 DEFINE(GPR7, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[7]));
75 DEFINE(GPR8, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[8]));
76 DEFINE(GPR9, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[9]));
77 DEFINE(GPR10, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[10]));
78 DEFINE(GPR11, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[11]));
79 DEFINE(GPR12, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[12]));
80 DEFINE(GPR13, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[13]));
81 DEFINE(GPR14, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[14]));
82 DEFINE(GPR15, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[15]));
83 DEFINE(GPR16, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[16]));
84 DEFINE(GPR17, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[17]));
85 DEFINE(GPR18, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[18]));
86 DEFINE(GPR19, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[19]));
87 DEFINE(GPR20, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[20]));
88 DEFINE(GPR21, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[21]));
89 DEFINE(GPR22, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[22]));
90 DEFINE(GPR23, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[23]));
91 DEFINE(GPR24, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[24]));
92 DEFINE(GPR25, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[25]));
93 DEFINE(GPR26, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[26]));
94 DEFINE(GPR27, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[27]));
95 DEFINE(GPR28, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[28]));
96 DEFINE(GPR29, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[29]));
97 DEFINE(GPR30, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[30]));
98 DEFINE(GPR31, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[31]));
99 /* Note: these symbols include _ because they overlap with special
100 * register names
102 DEFINE(_NIP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, nip));
103 DEFINE(_MSR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, msr));
104 DEFINE(_CTR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ctr));
105 DEFINE(_LINK, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, link));
106 DEFINE(_CCR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ccr));
107 DEFINE(_MQ, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, mq));
108 DEFINE(_XER, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, xer));
109 DEFINE(_DAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
110 DEFINE(_DSISR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
111 /* The PowerPC 400-class & Book-E processors have neither the DAR nor the DSISR
112 * SPRs. Hence, we overload them to hold the similar DEAR and ESR SPRs
113 * for such processors. For critical interrupts we use them to
114 * hold SRR0 and SRR1.
116 DEFINE(_DEAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
117 DEFINE(_ESR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
118 DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3));
119 DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result));
120 DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
121 DEFINE(CLONE_VM, CLONE_VM);
122 DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
123 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd));
125 /* About the CPU features table */
126 DEFINE(CPU_SPEC_ENTRY_SIZE, sizeof(struct cpu_spec));
127 DEFINE(CPU_SPEC_PVR_MASK, offsetof(struct cpu_spec, pvr_mask));
128 DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
129 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
130 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
132 DEFINE(TI_TASK, offsetof(struct thread_info, task));
133 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
134 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
135 DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
136 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
137 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
139 DEFINE(pbe_address, offsetof(struct pbe, address));
140 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
141 DEFINE(pbe_next, offsetof(struct pbe, next));
143 DEFINE(TASK_SIZE, TASK_SIZE);
144 DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
146 /* datapage offsets for use by vdso */
147 DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct vdso_data, tb_orig_stamp));
148 DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct vdso_data, tb_ticks_per_sec));
149 DEFINE(CFG_TB_TO_XS, offsetof(struct vdso_data, tb_to_xs));
150 DEFINE(CFG_STAMP_XSEC, offsetof(struct vdso_data, stamp_xsec));
151 DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct vdso_data, tb_update_count));
152 DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct vdso_data, tz_minuteswest));
153 DEFINE(CFG_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime));
154 DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32));
155 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
156 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
157 DEFINE(TVAL32_TV_SEC, offsetof(struct timeval, tv_sec));
158 DEFINE(TVAL32_TV_USEC, offsetof(struct timeval, tv_usec));
159 DEFINE(TSPEC32_TV_SEC, offsetof(struct timespec, tv_sec));
160 DEFINE(TSPEC32_TV_NSEC, offsetof(struct timespec, tv_nsec));
162 /* timeval/timezone offsets for use by vdso */
163 DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
164 DEFINE(TZONE_TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
166 /* Other bits used by the vdso */
167 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
168 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
169 DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
170 DEFINE(CLOCK_REALTIME_RES, TICK_NSEC);
172 return 0;