diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/kernel/offset.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/mips/kernel/offset.c')
-rw-r--r-- | arch/mips/kernel/offset.c | 314 |
1 files changed, 314 insertions, 0 deletions
diff --git a/arch/mips/kernel/offset.c b/arch/mips/kernel/offset.c new file mode 100644 index 000000000000..2c11abb5a406 --- /dev/null +++ b/arch/mips/kernel/offset.c | |||
@@ -0,0 +1,314 @@ | |||
1 | /* | ||
2 | * offset.c: Calculate pt_regs and task_struct offsets. | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller | ||
5 | * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Ralf Baechle | ||
6 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. | ||
7 | * | ||
8 | * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com | ||
9 | * Copyright (C) 2000 MIPS Technologies, Inc. | ||
10 | */ | ||
11 | #include <linux/config.h> | ||
12 | #include <linux/compat.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/mm.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | |||
18 | #include <asm/ptrace.h> | ||
19 | #include <asm/processor.h> | ||
20 | |||
21 | #define text(t) __asm__("\n@@@" t) | ||
22 | #define _offset(type, member) (&(((type *)NULL)->member)) | ||
23 | #define offset(string, ptr, member) \ | ||
24 | __asm__("\n@@@" string "%0" : : "i" (_offset(ptr, member))) | ||
25 | #define constant(string, member) \ | ||
26 | __asm__("\n@@@" string "%x0" : : "ri" (member)) | ||
27 | #define size(string, size) \ | ||
28 | __asm__("\n@@@" string "%0" : : "i" (sizeof(size))) | ||
29 | #define linefeed text("") | ||
30 | |||
31 | void output_ptreg_defines(void) | ||
32 | { | ||
33 | text("/* MIPS pt_regs offsets. */"); | ||
34 | offset("#define PT_R0 ", struct pt_regs, regs[0]); | ||
35 | offset("#define PT_R1 ", struct pt_regs, regs[1]); | ||
36 | offset("#define PT_R2 ", struct pt_regs, regs[2]); | ||
37 | offset("#define PT_R3 ", struct pt_regs, regs[3]); | ||
38 | offset("#define PT_R4 ", struct pt_regs, regs[4]); | ||
39 | offset("#define PT_R5 ", struct pt_regs, regs[5]); | ||
40 | offset("#define PT_R6 ", struct pt_regs, regs[6]); | ||
41 | offset("#define PT_R7 ", struct pt_regs, regs[7]); | ||
42 | offset("#define PT_R8 ", struct pt_regs, regs[8]); | ||
43 | offset("#define PT_R9 ", struct pt_regs, regs[9]); | ||
44 | offset("#define PT_R10 ", struct pt_regs, regs[10]); | ||
45 | offset("#define PT_R11 ", struct pt_regs, regs[11]); | ||
46 | offset("#define PT_R12 ", struct pt_regs, regs[12]); | ||
47 | offset("#define PT_R13 ", struct pt_regs, regs[13]); | ||
48 | offset("#define PT_R14 ", struct pt_regs, regs[14]); | ||
49 | offset("#define PT_R15 ", struct pt_regs, regs[15]); | ||
50 | offset("#define PT_R16 ", struct pt_regs, regs[16]); | ||
51 | offset("#define PT_R17 ", struct pt_regs, regs[17]); | ||
52 | offset("#define PT_R18 ", struct pt_regs, regs[18]); | ||
53 | offset("#define PT_R19 ", struct pt_regs, regs[19]); | ||
54 | offset("#define PT_R20 ", struct pt_regs, regs[20]); | ||
55 | offset("#define PT_R21 ", struct pt_regs, regs[21]); | ||
56 | offset("#define PT_R22 ", struct pt_regs, regs[22]); | ||
57 | offset("#define PT_R23 ", struct pt_regs, regs[23]); | ||
58 | offset("#define PT_R24 ", struct pt_regs, regs[24]); | ||
59 | offset("#define PT_R25 ", struct pt_regs, regs[25]); | ||
60 | offset("#define PT_R26 ", struct pt_regs, regs[26]); | ||
61 | offset("#define PT_R27 ", struct pt_regs, regs[27]); | ||
62 | offset("#define PT_R28 ", struct pt_regs, regs[28]); | ||
63 | offset("#define PT_R29 ", struct pt_regs, regs[29]); | ||
64 | offset("#define PT_R30 ", struct pt_regs, regs[30]); | ||
65 | offset("#define PT_R31 ", struct pt_regs, regs[31]); | ||
66 | offset("#define PT_LO ", struct pt_regs, lo); | ||
67 | offset("#define PT_HI ", struct pt_regs, hi); | ||
68 | offset("#define PT_EPC ", struct pt_regs, cp0_epc); | ||
69 | offset("#define PT_BVADDR ", struct pt_regs, cp0_badvaddr); | ||
70 | offset("#define PT_STATUS ", struct pt_regs, cp0_status); | ||
71 | offset("#define PT_CAUSE ", struct pt_regs, cp0_cause); | ||
72 | size("#define PT_SIZE ", struct pt_regs); | ||
73 | linefeed; | ||
74 | } | ||
75 | |||
76 | void output_task_defines(void) | ||
77 | { | ||
78 | text("/* MIPS task_struct offsets. */"); | ||
79 | offset("#define TASK_STATE ", struct task_struct, state); | ||
80 | offset("#define TASK_THREAD_INFO ", struct task_struct, thread_info); | ||
81 | offset("#define TASK_FLAGS ", struct task_struct, flags); | ||
82 | offset("#define TASK_MM ", struct task_struct, mm); | ||
83 | offset("#define TASK_PID ", struct task_struct, pid); | ||
84 | size( "#define TASK_STRUCT_SIZE ", struct task_struct); | ||
85 | linefeed; | ||
86 | } | ||
87 | |||
88 | void output_thread_info_defines(void) | ||
89 | { | ||
90 | text("/* MIPS thread_info offsets. */"); | ||
91 | offset("#define TI_TASK ", struct thread_info, task); | ||
92 | offset("#define TI_EXEC_DOMAIN ", struct thread_info, exec_domain); | ||
93 | offset("#define TI_FLAGS ", struct thread_info, flags); | ||
94 | offset("#define TI_CPU ", struct thread_info, cpu); | ||
95 | offset("#define TI_PRE_COUNT ", struct thread_info, preempt_count); | ||
96 | offset("#define TI_ADDR_LIMIT ", struct thread_info, addr_limit); | ||
97 | offset("#define TI_RESTART_BLOCK ", struct thread_info, restart_block); | ||
98 | constant("#define _THREAD_SIZE_ORDER ", THREAD_SIZE_ORDER); | ||
99 | constant("#define _THREAD_SIZE ", THREAD_SIZE); | ||
100 | constant("#define _THREAD_MASK ", THREAD_MASK); | ||
101 | linefeed; | ||
102 | } | ||
103 | |||
104 | void output_thread_defines(void) | ||
105 | { | ||
106 | text("/* MIPS specific thread_struct offsets. */"); | ||
107 | offset("#define THREAD_REG16 ", struct task_struct, thread.reg16); | ||
108 | offset("#define THREAD_REG17 ", struct task_struct, thread.reg17); | ||
109 | offset("#define THREAD_REG18 ", struct task_struct, thread.reg18); | ||
110 | offset("#define THREAD_REG19 ", struct task_struct, thread.reg19); | ||
111 | offset("#define THREAD_REG20 ", struct task_struct, thread.reg20); | ||
112 | offset("#define THREAD_REG21 ", struct task_struct, thread.reg21); | ||
113 | offset("#define THREAD_REG22 ", struct task_struct, thread.reg22); | ||
114 | offset("#define THREAD_REG23 ", struct task_struct, thread.reg23); | ||
115 | offset("#define THREAD_REG29 ", struct task_struct, thread.reg29); | ||
116 | offset("#define THREAD_REG30 ", struct task_struct, thread.reg30); | ||
117 | offset("#define THREAD_REG31 ", struct task_struct, thread.reg31); | ||
118 | offset("#define THREAD_STATUS ", struct task_struct, | ||
119 | thread.cp0_status); | ||
120 | offset("#define THREAD_FPU ", struct task_struct, thread.fpu); | ||
121 | |||
122 | offset("#define THREAD_BVADDR ", struct task_struct, \ | ||
123 | thread.cp0_badvaddr); | ||
124 | offset("#define THREAD_BUADDR ", struct task_struct, \ | ||
125 | thread.cp0_baduaddr); | ||
126 | offset("#define THREAD_ECODE ", struct task_struct, \ | ||
127 | thread.error_code); | ||
128 | offset("#define THREAD_TRAPNO ", struct task_struct, thread.trap_no); | ||
129 | offset("#define THREAD_MFLAGS ", struct task_struct, thread.mflags); | ||
130 | offset("#define THREAD_TRAMP ", struct task_struct, \ | ||
131 | thread.irix_trampoline); | ||
132 | offset("#define THREAD_OLDCTX ", struct task_struct, \ | ||
133 | thread.irix_oldctx); | ||
134 | linefeed; | ||
135 | } | ||
136 | |||
137 | void output_thread_fpu_defines(void) | ||
138 | { | ||
139 | offset("#define THREAD_FPR0 ", | ||
140 | struct task_struct, thread.fpu.hard.fpr[0]); | ||
141 | offset("#define THREAD_FPR1 ", | ||
142 | struct task_struct, thread.fpu.hard.fpr[1]); | ||
143 | offset("#define THREAD_FPR2 ", | ||
144 | struct task_struct, thread.fpu.hard.fpr[2]); | ||
145 | offset("#define THREAD_FPR3 ", | ||
146 | struct task_struct, thread.fpu.hard.fpr[3]); | ||
147 | offset("#define THREAD_FPR4 ", | ||
148 | struct task_struct, thread.fpu.hard.fpr[4]); | ||
149 | offset("#define THREAD_FPR5 ", | ||
150 | struct task_struct, thread.fpu.hard.fpr[5]); | ||
151 | offset("#define THREAD_FPR6 ", | ||
152 | struct task_struct, thread.fpu.hard.fpr[6]); | ||
153 | offset("#define THREAD_FPR7 ", | ||
154 | struct task_struct, thread.fpu.hard.fpr[7]); | ||
155 | offset("#define THREAD_FPR8 ", | ||
156 | struct task_struct, thread.fpu.hard.fpr[8]); | ||
157 | offset("#define THREAD_FPR9 ", | ||
158 | struct task_struct, thread.fpu.hard.fpr[9]); | ||
159 | offset("#define THREAD_FPR10 ", | ||
160 | struct task_struct, thread.fpu.hard.fpr[10]); | ||
161 | offset("#define THREAD_FPR11 ", | ||
162 | struct task_struct, thread.fpu.hard.fpr[11]); | ||
163 | offset("#define THREAD_FPR12 ", | ||
164 | struct task_struct, thread.fpu.hard.fpr[12]); | ||
165 | offset("#define THREAD_FPR13 ", | ||
166 | struct task_struct, thread.fpu.hard.fpr[13]); | ||
167 | offset("#define THREAD_FPR14 ", | ||
168 | struct task_struct, thread.fpu.hard.fpr[14]); | ||
169 | offset("#define THREAD_FPR15 ", | ||
170 | struct task_struct, thread.fpu.hard.fpr[15]); | ||
171 | offset("#define THREAD_FPR16 ", | ||
172 | struct task_struct, thread.fpu.hard.fpr[16]); | ||
173 | offset("#define THREAD_FPR17 ", | ||
174 | struct task_struct, thread.fpu.hard.fpr[17]); | ||
175 | offset("#define THREAD_FPR18 ", | ||
176 | struct task_struct, thread.fpu.hard.fpr[18]); | ||
177 | offset("#define THREAD_FPR19 ", | ||
178 | struct task_struct, thread.fpu.hard.fpr[19]); | ||
179 | offset("#define THREAD_FPR20 ", | ||
180 | struct task_struct, thread.fpu.hard.fpr[20]); | ||
181 | offset("#define THREAD_FPR21 ", | ||
182 | struct task_struct, thread.fpu.hard.fpr[21]); | ||
183 | offset("#define THREAD_FPR22 ", | ||
184 | struct task_struct, thread.fpu.hard.fpr[22]); | ||
185 | offset("#define THREAD_FPR23 ", | ||
186 | struct task_struct, thread.fpu.hard.fpr[23]); | ||
187 | offset("#define THREAD_FPR24 ", | ||
188 | struct task_struct, thread.fpu.hard.fpr[24]); | ||
189 | offset("#define THREAD_FPR25 ", | ||
190 | struct task_struct, thread.fpu.hard.fpr[25]); | ||
191 | offset("#define THREAD_FPR26 ", | ||
192 | struct task_struct, thread.fpu.hard.fpr[26]); | ||
193 | offset("#define THREAD_FPR27 ", | ||
194 | struct task_struct, thread.fpu.hard.fpr[27]); | ||
195 | offset("#define THREAD_FPR28 ", | ||
196 | struct task_struct, thread.fpu.hard.fpr[28]); | ||
197 | offset("#define THREAD_FPR29 ", | ||
198 | struct task_struct, thread.fpu.hard.fpr[29]); | ||
199 | offset("#define THREAD_FPR30 ", | ||
200 | struct task_struct, thread.fpu.hard.fpr[30]); | ||
201 | offset("#define THREAD_FPR31 ", | ||
202 | struct task_struct, thread.fpu.hard.fpr[31]); | ||
203 | |||
204 | offset("#define THREAD_FCR31 ", | ||
205 | struct task_struct, thread.fpu.hard.fcr31); | ||
206 | linefeed; | ||
207 | } | ||
208 | |||
209 | void output_mm_defines(void) | ||
210 | { | ||
211 | text("/* Size of struct page */"); | ||
212 | size("#define STRUCT_PAGE_SIZE ", struct page); | ||
213 | linefeed; | ||
214 | text("/* Linux mm_struct offsets. */"); | ||
215 | offset("#define MM_USERS ", struct mm_struct, mm_users); | ||
216 | offset("#define MM_PGD ", struct mm_struct, pgd); | ||
217 | offset("#define MM_CONTEXT ", struct mm_struct, context); | ||
218 | linefeed; | ||
219 | constant("#define _PAGE_SIZE ", PAGE_SIZE); | ||
220 | constant("#define _PAGE_SHIFT ", PAGE_SHIFT); | ||
221 | linefeed; | ||
222 | constant("#define _PGD_T_SIZE ", sizeof(pgd_t)); | ||
223 | constant("#define _PMD_T_SIZE ", sizeof(pmd_t)); | ||
224 | constant("#define _PTE_T_SIZE ", sizeof(pte_t)); | ||
225 | linefeed; | ||
226 | constant("#define _PGD_T_LOG2 ", PGD_T_LOG2); | ||
227 | constant("#define _PMD_T_LOG2 ", PMD_T_LOG2); | ||
228 | constant("#define _PTE_T_LOG2 ", PTE_T_LOG2); | ||
229 | linefeed; | ||
230 | constant("#define _PMD_SHIFT ", PMD_SHIFT); | ||
231 | constant("#define _PGDIR_SHIFT ", PGDIR_SHIFT); | ||
232 | linefeed; | ||
233 | constant("#define _PGD_ORDER ", PGD_ORDER); | ||
234 | constant("#define _PMD_ORDER ", PMD_ORDER); | ||
235 | constant("#define _PTE_ORDER ", PTE_ORDER); | ||
236 | linefeed; | ||
237 | constant("#define _PTRS_PER_PGD ", PTRS_PER_PGD); | ||
238 | constant("#define _PTRS_PER_PMD ", PTRS_PER_PMD); | ||
239 | constant("#define _PTRS_PER_PTE ", PTRS_PER_PTE); | ||
240 | linefeed; | ||
241 | } | ||
242 | |||
243 | void output_sc_defines(void) | ||
244 | { | ||
245 | text("/* Linux sigcontext offsets. */"); | ||
246 | offset("#define SC_REGS ", struct sigcontext, sc_regs); | ||
247 | offset("#define SC_FPREGS ", struct sigcontext, sc_fpregs); | ||
248 | offset("#define SC_MDHI ", struct sigcontext, sc_mdhi); | ||
249 | offset("#define SC_MDLO ", struct sigcontext, sc_mdlo); | ||
250 | offset("#define SC_PC ", struct sigcontext, sc_pc); | ||
251 | offset("#define SC_STATUS ", struct sigcontext, sc_status); | ||
252 | offset("#define SC_FPC_CSR ", struct sigcontext, sc_fpc_csr); | ||
253 | offset("#define SC_FPC_EIR ", struct sigcontext, sc_fpc_eir); | ||
254 | offset("#define SC_CAUSE ", struct sigcontext, sc_cause); | ||
255 | offset("#define SC_BADVADDR ", struct sigcontext, sc_badvaddr); | ||
256 | linefeed; | ||
257 | } | ||
258 | |||
259 | #ifdef CONFIG_MIPS32_COMPAT | ||
260 | void output_sc32_defines(void) | ||
261 | { | ||
262 | text("/* Linux 32-bit sigcontext offsets. */"); | ||
263 | offset("#define SC32_FPREGS ", struct sigcontext32, sc_fpregs); | ||
264 | offset("#define SC32_FPC_CSR ", struct sigcontext32, sc_fpc_csr); | ||
265 | offset("#define SC32_FPC_EIR ", struct sigcontext32, sc_fpc_eir); | ||
266 | linefeed; | ||
267 | } | ||
268 | #endif | ||
269 | |||
270 | void output_signal_defined(void) | ||
271 | { | ||
272 | text("/* Linux signal numbers. */"); | ||
273 | constant("#define _SIGHUP ", SIGHUP); | ||
274 | constant("#define _SIGINT ", SIGINT); | ||
275 | constant("#define _SIGQUIT ", SIGQUIT); | ||
276 | constant("#define _SIGILL ", SIGILL); | ||
277 | constant("#define _SIGTRAP ", SIGTRAP); | ||
278 | constant("#define _SIGIOT ", SIGIOT); | ||
279 | constant("#define _SIGABRT ", SIGABRT); | ||
280 | constant("#define _SIGEMT ", SIGEMT); | ||
281 | constant("#define _SIGFPE ", SIGFPE); | ||
282 | constant("#define _SIGKILL ", SIGKILL); | ||
283 | constant("#define _SIGBUS ", SIGBUS); | ||
284 | constant("#define _SIGSEGV ", SIGSEGV); | ||
285 | constant("#define _SIGSYS ", SIGSYS); | ||
286 | constant("#define _SIGPIPE ", SIGPIPE); | ||
287 | constant("#define _SIGALRM ", SIGALRM); | ||
288 | constant("#define _SIGTERM ", SIGTERM); | ||
289 | constant("#define _SIGUSR1 ", SIGUSR1); | ||
290 | constant("#define _SIGUSR2 ", SIGUSR2); | ||
291 | constant("#define _SIGCHLD ", SIGCHLD); | ||
292 | constant("#define _SIGPWR ", SIGPWR); | ||
293 | constant("#define _SIGWINCH ", SIGWINCH); | ||
294 | constant("#define _SIGURG ", SIGURG); | ||
295 | constant("#define _SIGIO ", SIGIO); | ||
296 | constant("#define _SIGSTOP ", SIGSTOP); | ||
297 | constant("#define _SIGTSTP ", SIGTSTP); | ||
298 | constant("#define _SIGCONT ", SIGCONT); | ||
299 | constant("#define _SIGTTIN ", SIGTTIN); | ||
300 | constant("#define _SIGTTOU ", SIGTTOU); | ||
301 | constant("#define _SIGVTALRM ", SIGVTALRM); | ||
302 | constant("#define _SIGPROF ", SIGPROF); | ||
303 | constant("#define _SIGXCPU ", SIGXCPU); | ||
304 | constant("#define _SIGXFSZ ", SIGXFSZ); | ||
305 | linefeed; | ||
306 | } | ||
307 | |||
308 | void output_irq_cpustat_t_defines(void) | ||
309 | { | ||
310 | text("/* Linux irq_cpustat_t offsets. */"); | ||
311 | offset("#define IC_SOFTIRQ_PENDING ", irq_cpustat_t, __softirq_pending); | ||
312 | size("#define IC_IRQ_CPUSTAT_T ", irq_cpustat_t); | ||
313 | linefeed; | ||
314 | } | ||