|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * genassym.c is used to produce an
27: * assembly file which, intermingled with unuseful assembly code,
28: * has all the necessary definitions emitted. This assembly file is
29: * then postprocessed with sed to extract only these definitions
30: * and thus the final assyms.s is created.
31: *
32: * This convoluted means is necessary since the structure alignment
33: * and packing may be different between the host machine and the
34: * target so we are forced into using the cross compiler to generate
35: * the values, but we cannot run anything on the target machine.
36: */
37: #include <mach/machine/thread_status.h>
38: #include <stddef.h>
39: #include <sys/types.h>
40: #include <kern/thread.h>
41: #include <kern/host.h>
42: #include <mach/machine/thread_status.h>
43: #include <machdep/ppc/frame.h>
44: #include <machdep/ppc/exception.h>
45: #include <kern/syscall_sw.h>
46: #include <machdep/ppc/PseudoKernel.h>
47:
48: #ifdef notdef_next
49: #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE)0)->MEMBER)
50:
51: #define DECLARE(SYM,VAL) \
52: __asm("#define\t" SYM "\t%0" : : "n" ((u_int)(VAL)))
53:
54: void main(void)
55: {
56: #endif /* notdef_next */
57:
58: /* Process Control Block */
59:
60: int _PCB_FLOAT_STATE = offsetof(struct pcb, fs);
61:
62: /* Floating point state */
63:
64: int _PCB_FS_F0 = offsetof(struct pcb, fs.fpregs[0]);
65: int _PCB_FS_F1 = offsetof(struct pcb, fs.fpregs[1]);
66: int _PCB_FS_F2 = offsetof(struct pcb, fs.fpregs[2]);
67: int _PCB_FS_F3 = offsetof(struct pcb, fs.fpregs[3]);
68: int _PCB_FS_F4 = offsetof(struct pcb, fs.fpregs[4]);
69: int _PCB_FS_F5 = offsetof(struct pcb, fs.fpregs[5]);
70: int _PCB_FS_F6 = offsetof(struct pcb, fs.fpregs[6]);
71: int _PCB_FS_F7 = offsetof(struct pcb, fs.fpregs[7]);
72: int _PCB_FS_F8 = offsetof(struct pcb, fs.fpregs[8]);
73: int _PCB_FS_F9 = offsetof(struct pcb, fs.fpregs[9]);
74: int _PCB_FS_F10 = offsetof(struct pcb, fs.fpregs[10]);
75: int _PCB_FS_F11 = offsetof(struct pcb, fs.fpregs[11]);
76: int _PCB_FS_F12 = offsetof(struct pcb, fs.fpregs[12]);
77: int _PCB_FS_F13 = offsetof(struct pcb, fs.fpregs[13]);
78: int _PCB_FS_F14 = offsetof(struct pcb, fs.fpregs[14]);
79: int _PCB_FS_F15 = offsetof(struct pcb, fs.fpregs[15]);
80: int _PCB_FS_F16 = offsetof(struct pcb, fs.fpregs[16]);
81: int _PCB_FS_F17 = offsetof(struct pcb, fs.fpregs[17]);
82: int _PCB_FS_F18 = offsetof(struct pcb, fs.fpregs[18]);
83: int _PCB_FS_F19 = offsetof(struct pcb, fs.fpregs[19]);
84: int _PCB_FS_F20 = offsetof(struct pcb, fs.fpregs[20]);
85: int _PCB_FS_F21 = offsetof(struct pcb, fs.fpregs[21]);
86: int _PCB_FS_F22 = offsetof(struct pcb, fs.fpregs[22]);
87: int _PCB_FS_F23 = offsetof(struct pcb, fs.fpregs[23]);
88: int _PCB_FS_F24 = offsetof(struct pcb, fs.fpregs[24]);
89: int _PCB_FS_F25 = offsetof(struct pcb, fs.fpregs[25]);
90: int _PCB_FS_F26 = offsetof(struct pcb, fs.fpregs[26]);
91: int _PCB_FS_F27 = offsetof(struct pcb, fs.fpregs[27]);
92: int _PCB_FS_F28 = offsetof(struct pcb, fs.fpregs[28]);
93: int _PCB_FS_F29 = offsetof(struct pcb, fs.fpregs[29]);
94: int _PCB_FS_F30 = offsetof(struct pcb, fs.fpregs[30]);
95: int _PCB_FS_F31 = offsetof(struct pcb, fs.fpregs[31]);
96: int _PCB_FS_FPSCR = offsetof(struct pcb, fs.fpscr_pad);
97:
98:
99: int _PCB_SAVED_STATE =offsetof(struct pcb, ss);
100: int _PCB_KSP = offsetof(struct pcb, ksp);
101: int _PCB_SR0 = offsetof(struct pcb, sr0);
102:
103: int _PCB_SIZE = sizeof(struct pcb);
104:
105: /* Save State Structure */
106: int _SS_R0 = offsetof(struct ppc_saved_state, r0);
107: int _SS_R1 = offsetof(struct ppc_saved_state, r1);
108: int _SS_R2 = offsetof(struct ppc_saved_state, r2);
109: int _SS_R3 = offsetof(struct ppc_saved_state, r3);
110: int _SS_R4 = offsetof(struct ppc_saved_state, r4);
111: int _SS_R5 = offsetof(struct ppc_saved_state, r5);
112: int _SS_R6 = offsetof(struct ppc_saved_state, r6);
113: int _SS_R7 = offsetof(struct ppc_saved_state, r7);
114: int _SS_R8 = offsetof(struct ppc_saved_state, r8);
115: int _SS_R9 = offsetof(struct ppc_saved_state, r9);
116: int _SS_R10 = offsetof(struct ppc_saved_state, r10);
117: int _SS_R11 = offsetof(struct ppc_saved_state, r11);
118: int _SS_R12 = offsetof(struct ppc_saved_state, r12);
119: int _SS_R13 = offsetof(struct ppc_saved_state, r13);
120: int _SS_R14 = offsetof(struct ppc_saved_state, r14);
121: int _SS_R15 = offsetof(struct ppc_saved_state, r15);
122: int _SS_R16 = offsetof(struct ppc_saved_state, r16);
123: int _SS_R17 = offsetof(struct ppc_saved_state, r17);
124: int _SS_R18 = offsetof(struct ppc_saved_state, r18);
125: int _SS_R19 = offsetof(struct ppc_saved_state, r19);
126: int _SS_R20 = offsetof(struct ppc_saved_state, r20);
127: int _SS_R21 = offsetof(struct ppc_saved_state, r21);
128: int _SS_R22 = offsetof(struct ppc_saved_state, r22);
129: int _SS_R23 = offsetof(struct ppc_saved_state, r23);
130: int _SS_R24 = offsetof(struct ppc_saved_state, r24);
131: int _SS_R25 = offsetof(struct ppc_saved_state, r25);
132: int _SS_R26 = offsetof(struct ppc_saved_state, r26);
133: int _SS_R27 = offsetof(struct ppc_saved_state, r27);
134: int _SS_R28 = offsetof(struct ppc_saved_state, r28);
135: int _SS_R29 = offsetof(struct ppc_saved_state, r29);
136: int _SS_R30 = offsetof(struct ppc_saved_state, r30);
137: int _SS_R31 = offsetof(struct ppc_saved_state, r31);
138: int _SS_CR = offsetof(struct ppc_saved_state, cr);
139: int _SS_XER = offsetof(struct ppc_saved_state, xer);
140: int _SS_LR = offsetof(struct ppc_saved_state, lr);
141: int _SS_CTR = offsetof(struct ppc_saved_state, ctr);
142: int _SS_SRR0 = offsetof(struct ppc_saved_state, srr0);
143: int _SS_SRR1 = offsetof(struct ppc_saved_state, srr1);
144: int _SS_MQ = offsetof(struct ppc_saved_state, mq);
145: int _SS_SR_COPYIN = offsetof(struct ppc_saved_state, sr_copyin);
146: int _CTHREAD_SELF = offsetof(struct pcb, cthread_self);
147: int _PCB_FLAGS = offsetof(struct pcb, flags);
148: int _SS_SIZE = sizeof(struct ppc_saved_state);
149:
150: /* Exception State structure */
151: int _PCB_ES_DAR = offsetof(struct pcb, es.dar);
152: int _PCB_ES_DSISR = offsetof(struct pcb, es.dsisr);
153:
154: /* Per Proc info structure */
155: int _PP_SAVE_CR = offsetof(struct per_proc_info, save_cr);
156: int _PP_SAVE_LR = offsetof(struct per_proc_info, save_lr);
157: int _PP_SAVE_SRR0 = offsetof(struct per_proc_info, save_srr0);
158: int _PP_SAVE_SRR1 = offsetof(struct per_proc_info, save_srr1);
159: int _PP_SAVE_DAR = offsetof(struct per_proc_info, save_dar);
160: int _PP_SAVE_DSISR = offsetof(struct per_proc_info, save_dsisr);
161: int _PP_SAVE_SPRG0 = offsetof(struct per_proc_info, save_sprg0);
162: int _PP_SAVE_SPRG1 = offsetof(struct per_proc_info, save_sprg1);
163: int _PP_SAVE_SPRG2 = offsetof(struct per_proc_info, save_sprg2);
164: int _PP_SAVE_SPRG3 = offsetof(struct per_proc_info, save_sprg3);
165:
166: int _PP_SAVE_R0 = offsetof(struct per_proc_info, save_r0);
167: int _PP_SAVE_R1 = offsetof(struct per_proc_info, save_r1);
168: int _PP_SAVE_R2 = offsetof(struct per_proc_info, save_r2);
169: int _PP_SAVE_R3 = offsetof(struct per_proc_info, save_r3);
170: int _PP_SAVE_R4 = offsetof(struct per_proc_info, save_r4);
171: int _PP_SAVE_R5 = offsetof(struct per_proc_info, save_r5);
172: int _PP_SAVE_R6 = offsetof(struct per_proc_info, save_r6);
173: int _PP_SAVE_R7 = offsetof(struct per_proc_info, save_r7);
174: int _PP_SAVE_R8 = offsetof(struct per_proc_info, save_r8);
175: int _PP_SAVE_R9 = offsetof(struct per_proc_info, save_r9);
176: int _PP_SAVE_R10 = offsetof(struct per_proc_info, save_r10);
177: int _PP_SAVE_R11 = offsetof(struct per_proc_info, save_r11);
178: int _PP_SAVE_R12 = offsetof(struct per_proc_info, save_r12);
179:
180: int _PP_SAVE_EXCEPTION_TYPE =
181: offsetof(struct per_proc_info, save_exception_type);
182: int _PP_CPU_DATA = offsetof(struct per_proc_info, cpu_data);
183: int _PP_PHYS_EXCEPTION_HANDLERS =
184: offsetof(struct per_proc_info, phys_exception_handlers);
185: int _PP_VIRT_PER_PROC =
186: offsetof(struct per_proc_info, virt_per_proc_info);
187: #ifdef notdef_next
188: int _PP_ACTIVE_KLOADED =
189: offsetof(struct per_proc_info, active_kloaded);
190: #endif /* notdef_next */
191: int _PP_ACTIVE_STACKS =
192: offsetof(struct per_proc_info, active_stacks);
193: int _PP_NEED_AST =
194: offsetof(struct per_proc_info, need_ast);
195: int _PP_FPU_PCB =
196: offsetof(struct per_proc_info, fpu_pcb);
197:
198: /* Kernel State Structure - special case as we want offset from
199: * bottom of kernel stack, not offset into structure
200: */
201: #define IKSBASE (u_int)STACK_IKS(0)
202:
203: int _KS_PCB = IKSBASE + offsetof(struct ppc_kernel_state, pcb);
204: int _KS_R1 = IKSBASE + offsetof(struct ppc_kernel_state, r1);
205: int _KS_R2 = IKSBASE + offsetof(struct ppc_kernel_state, r2);
206: int _KS_R13 = IKSBASE + offsetof(struct ppc_kernel_state, r13);
207: int _KS_LR = IKSBASE + offsetof(struct ppc_kernel_state, lr);
208: int _KS_CR = IKSBASE + offsetof(struct ppc_kernel_state, cr);
209: int _KS_SIZE = sizeof(struct ppc_kernel_state);
210: int _KSTK_SIZE = KERNEL_STACK_SIZE;
211:
212: /* values from kern/thread.h */
213: int _THREAD_PCB = offsetof(struct thread, pcb);
214: int _THREAD_KERNEL_STACK = offsetof(struct thread, kernel_stack);
215: int _THREAD_SWAPFUNC = offsetof(struct thread, swap_func);
216: int _THREAD_RECOVER = offsetof(struct thread, recover);
217: int _THREAD_TASK = offsetof(struct thread, task);
218: int _THREAD_AST = offsetof(struct thread, ast);
219: #ifdef notdef_next
220: DECLARE("THREAD_TOP_ACT",
221: offsetof(struct thread_shuttle *, top_act));
222: DECLARE("THREAD_CONTINUATION",
223: offsetof(struct thread_shuttle *, continuation));
224:
225: /* values from kern/thread_act.h */
226: DECLARE("ACT_TASK", offsetof(struct thread_activation *, task));
227: DECLARE("ACT_MACT_PCB",offsetof(struct thread_activation *, mact.pcb));
228: DECLARE("ACT_AST", offsetof(struct thread_activation *, ast));
229: DECLARE("ACT_VMMAP", offsetof(struct thread_activation *, map));
230: DECLARE("ACT_KLOADED",
231: offsetof(struct thread_activation *, kernel_loaded));
232: DECLARE("ACT_KLOADING",
233: offsetof(struct thread_activation *, kernel_loading));
234: DECLARE("ACT_MACH_EXC_PORT",
235: offsetof(struct thread_activation *,
236: exc_actions[EXC_MACH_SYSCALL].port));
237: #endif
238:
239: /* values from kern/task.h */
240: #ifdef notdef_next
241: DECLARE("TASK_MACH_EXC_PORT",
242: offsetof(struct task *, exc_actions[EXC_MACH_SYSCALL].port));
243: #else /* notdef_next */
244: int _TASK_VMMAP = offsetof(struct task, map);
245: int _TASK_MACH_EXC_PORT = offsetof(struct task, itk_exception);
246: #endif /* notdef_next */
247:
248: /* values from vm/vm_map.h */
249: int _VMMAP_PMAP = offsetof(struct vm_map, pmap);
250:
251: /* values from machine/pmap.h */
252: int _PMAP_SPACE = offsetof(struct pmap, space);
253:
254: #ifdef notdef_next
255: /* Constants from pmap.h */
256: DECLARE("PPC_SID_KERNEL", PPC_SID_KERNEL);
257: #endif /* notdef_next */
258:
259: /* values for accessing mach_trap table */
260: int _MACH_TRAP_OFFSET_POW2 = 4;
261:
262: int _MACH_TRAP_ARGC =
263: offsetof(mach_trap_t, mach_trap_arg_count);
264: int _MACH_TRAP_FUNCTION =
265: offsetof(mach_trap_t, mach_trap_function);
266:
267: int _HOST_SELF = offsetof(struct host, host_self);
268:
269: /* values from cpu_data.h */
270: int _CPU_ACTIVE_THREAD = offsetof(cpu_data_t, active_thread);
271: int _CPU_FLAGS = offsetof(cpu_data_t, flags);
272:
273: #ifdef notdef_next
274: /* Misc values used by assembler */
275: int _AST_ALL = 0;
276: }
277: #endif /* notdef_next */
278:
279:
280: /* Frame Structure */
281: int _FM_SIZE = sizeof(struct frame_area);
282:
283: // int _NARGS = (sizeof(struct param_area)/ sizeof(int));
284:
285: // int _MAXREGARGS = (sizeof(struct reg_param_area)/ sizeof(int));
286:
287: int _ARG_SIZE = sizeof(struct stack_param_area);
288:
289: int _LA_SIZE = sizeof(struct linkage_area);
290: int _FM_BACKPTR = offsetof(struct stack_frame, la.saved_sp);
291: int _FM_CR_SAVE = offsetof(struct stack_frame, la.saved_cr);
292: int _FM_LR_SAVE = offsetof(struct stack_frame, la.saved_lr);
293: int _FM_TOC_SAVE= offsetof(struct stack_frame, la.saved_r2);
294:
295: int _RPA_SIZE = sizeof(struct reg_param_area);
296: int _SPA_SIZE = sizeof(struct stack_param_area);
297:
298: int _FM_ARG0 = offsetof(struct stack_frame, pa.spa.saved_p8);
299:
300: int _FM_REDZONE = sizeof (struct redzone);
301:
302:
303: /* CallPseudoKernel info */
304: int _CPKD_PC = offsetof(CPKD_t, pc);
305: int _CPKD_GPR0 = offsetof(CPKD_t, gpr0);
306: int _CPKD_INTCONTROLADDR = offsetof(CPKD_t, intControlAddr);
307: int _CPKD_NEWSTATE = offsetof(CPKD_t, newState);
308: int _CPKD_INTSTATEMASK = offsetof(CPKD_t, intStateMask);
309: int _CPKD_INTCR2MASK = offsetof(CPKD_t, intCR2Mask);
310: int _CPKD_INTCR2SHIFT = offsetof(CPKD_t, intCR2Shift);
311: int _CPKD_SYSCONTEXTSTATE = offsetof(CPKD_t, sysContextState);
312:
313:
314: /* ExitPseudoKernel info */
315: int _EPKD_PC = offsetof(EPKD_t, pc);
316: int _EPKD_SP = offsetof(EPKD_t, sp);
317: int _EPKD_GPR0 = offsetof(EPKD_t, gpr0);
318: int _EPKD_GPR3 = offsetof(EPKD_t, gpr3);
319: int _EPKD_CR = offsetof(EPKD_t, cr);
320: int _EPKD_INTCONTROLADDR = offsetof(EPKD_t, intControlAddr);
321: int _EPKD_NEWSTATE = offsetof(EPKD_t, newState);
322: int _EPKD_INTSTATEMASK = offsetof(EPKD_t, intStateMask);
323: int _EPKD_INTCR2MASK = offsetof(EPKD_t, intCR2Mask);
324: int _EPKD_INTCR2SHIFT = offsetof(EPKD_t, intCR2Shift);
325: int _EPKD_SYSCONTEXTSTATE = offsetof(EPKD_t, sysContextState);
326: int _EPKD_INTPENDINGMASK = offsetof(EPKD_t, intPendingMask);
327: int _EPKD_INTPENDINGPC = offsetof(EPKD_t, intPendingPC);
328: int _EPKD_MSRUPDATE = offsetof(EPKD_t, msrUpdate);
329:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.