Root/
Source at commit 1079 created 13 years 1 month ago. By meklort, began implimenting Bios disk changes. Code taken from biosfn.c | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. The rights granted to you under the License␊ |
10 | * may not be used to create, or enable the creation or redistribution of,␊ |
11 | * unlawful or unlicensed copies of an Apple operating system, or to␊ |
12 | * circumvent, violate, or enable the circumvention or violation of, any␊ |
13 | * terms of an Apple operating system software license agreement.␊ |
14 | * ␊ |
15 | * Please obtain a copy of the License at␊ |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file.␊ |
17 | * ␊ |
18 | * The Original Code and all software distributed under the License are␊ |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
23 | * Please see the License for the specific language governing rights and␊ |
24 | * limitations under the License.␊ |
25 | * ␊ |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@␊ |
27 | */␊ |
28 | /*␊ |
29 | * @OSF_COPYRIGHT@␊ |
30 | */␊ |
31 | ␊ |
32 | #ifndef␉_MACH_PPC__STRUCTS_H_␊ |
33 | #define␉_MACH_PPC__STRUCTS_H_␊ |
34 | ␊ |
35 | #include <sys/cdefs.h>␊ |
36 | ␊ |
37 | /*␊ |
38 | * ppc_thread_state is the structure that is exported to user threads for ␊ |
39 | * use in status/mutate calls. This structure should never change.␊ |
40 | *␊ |
41 | */␊ |
42 | ␊ |
43 | #if __DARWIN_UNIX03␊ |
44 | #define␉_STRUCT_PPC_THREAD_STATE␉struct __darwin_ppc_thread_state␊ |
45 | _STRUCT_PPC_THREAD_STATE␊ |
46 | {␊ |
47 | ␉unsigned int __srr0;␉/* Instruction address register (PC) */␊ |
48 | ␉unsigned int __srr1;␉/* Machine state register (supervisor) */␊ |
49 | ␉unsigned int __r0;␊ |
50 | ␉unsigned int __r1;␊ |
51 | ␉unsigned int __r2;␊ |
52 | ␉unsigned int __r3;␊ |
53 | ␉unsigned int __r4;␊ |
54 | ␉unsigned int __r5;␊ |
55 | ␉unsigned int __r6;␊ |
56 | ␉unsigned int __r7;␊ |
57 | ␉unsigned int __r8;␊ |
58 | ␉unsigned int __r9;␊ |
59 | ␉unsigned int __r10;␊ |
60 | ␉unsigned int __r11;␊ |
61 | ␉unsigned int __r12;␊ |
62 | ␉unsigned int __r13;␊ |
63 | ␉unsigned int __r14;␊ |
64 | ␉unsigned int __r15;␊ |
65 | ␉unsigned int __r16;␊ |
66 | ␉unsigned int __r17;␊ |
67 | ␉unsigned int __r18;␊ |
68 | ␉unsigned int __r19;␊ |
69 | ␉unsigned int __r20;␊ |
70 | ␉unsigned int __r21;␊ |
71 | ␉unsigned int __r22;␊ |
72 | ␉unsigned int __r23;␊ |
73 | ␉unsigned int __r24;␊ |
74 | ␉unsigned int __r25;␊ |
75 | ␉unsigned int __r26;␊ |
76 | ␉unsigned int __r27;␊ |
77 | ␉unsigned int __r28;␊ |
78 | ␉unsigned int __r29;␊ |
79 | ␉unsigned int __r30;␊ |
80 | ␉unsigned int __r31;␊ |
81 | ␊ |
82 | ␉unsigned int __cr;␉/* Condition register */␊ |
83 | ␉unsigned int __xer;␉/* User's integer exception register */␊ |
84 | ␉unsigned int __lr;␉/* Link register */␊ |
85 | ␉unsigned int __ctr;␉/* Count register */␊ |
86 | ␉unsigned int __mq;␉/* MQ register (601 only) */␊ |
87 | ␊ |
88 | ␉unsigned int __vrsave;␉/* Vector Save Register */␊ |
89 | };␊ |
90 | #else /* !__DARWIN_UNIX03 */␊ |
91 | #define␉_STRUCT_PPC_THREAD_STATE␉struct ppc_thread_state␊ |
92 | _STRUCT_PPC_THREAD_STATE␊ |
93 | {␊ |
94 | ␉unsigned int srr0;␉/* Instruction address register (PC) */␊ |
95 | ␉unsigned int srr1;␉/* Machine state register (supervisor) */␊ |
96 | ␉unsigned int r0;␊ |
97 | ␉unsigned int r1;␊ |
98 | ␉unsigned int r2;␊ |
99 | ␉unsigned int r3;␊ |
100 | ␉unsigned int r4;␊ |
101 | ␉unsigned int r5;␊ |
102 | ␉unsigned int r6;␊ |
103 | ␉unsigned int r7;␊ |
104 | ␉unsigned int r8;␊ |
105 | ␉unsigned int r9;␊ |
106 | ␉unsigned int r10;␊ |
107 | ␉unsigned int r11;␊ |
108 | ␉unsigned int r12;␊ |
109 | ␉unsigned int r13;␊ |
110 | ␉unsigned int r14;␊ |
111 | ␉unsigned int r15;␊ |
112 | ␉unsigned int r16;␊ |
113 | ␉unsigned int r17;␊ |
114 | ␉unsigned int r18;␊ |
115 | ␉unsigned int r19;␊ |
116 | ␉unsigned int r20;␊ |
117 | ␉unsigned int r21;␊ |
118 | ␉unsigned int r22;␊ |
119 | ␉unsigned int r23;␊ |
120 | ␉unsigned int r24;␊ |
121 | ␉unsigned int r25;␊ |
122 | ␉unsigned int r26;␊ |
123 | ␉unsigned int r27;␊ |
124 | ␉unsigned int r28;␊ |
125 | ␉unsigned int r29;␊ |
126 | ␉unsigned int r30;␊ |
127 | ␉unsigned int r31;␊ |
128 | ␊ |
129 | ␉unsigned int cr;␉/* Condition register */␊ |
130 | ␉unsigned int xer;␉/* User's integer exception register */␊ |
131 | ␉unsigned int lr;␉/* Link register */␊ |
132 | ␉unsigned int ctr;␉/* Count register */␊ |
133 | ␉unsigned int mq;␉/* MQ register (601 only) */␊ |
134 | ␊ |
135 | ␉unsigned int vrsave;␉/* Vector Save Register */␊ |
136 | };␊ |
137 | #endif /* __DARWIN_UNIX03 */␊ |
138 | ␊ |
139 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
140 | ␊ |
141 | #pragma pack(4)␉␉␉/* Make sure the structure stays as we defined it */␊ |
142 | ␊ |
143 | #if __DARWIN_UNIX03␊ |
144 | #define _STRUCT_PPC_THREAD_STATE64␉struct __darwin_ppc_thread_state64␊ |
145 | _STRUCT_PPC_THREAD_STATE64␊ |
146 | {␊ |
147 | ␉unsigned long long __srr0;␉/* Instruction address register (PC) */␊ |
148 | ␉unsigned long long __srr1;␉/* Machine state register (supervisor) */␊ |
149 | ␉unsigned long long __r0;␊ |
150 | ␉unsigned long long __r1;␊ |
151 | ␉unsigned long long __r2;␊ |
152 | ␉unsigned long long __r3;␊ |
153 | ␉unsigned long long __r4;␊ |
154 | ␉unsigned long long __r5;␊ |
155 | ␉unsigned long long __r6;␊ |
156 | ␉unsigned long long __r7;␊ |
157 | ␉unsigned long long __r8;␊ |
158 | ␉unsigned long long __r9;␊ |
159 | ␉unsigned long long __r10;␊ |
160 | ␉unsigned long long __r11;␊ |
161 | ␉unsigned long long __r12;␊ |
162 | ␉unsigned long long __r13;␊ |
163 | ␉unsigned long long __r14;␊ |
164 | ␉unsigned long long __r15;␊ |
165 | ␉unsigned long long __r16;␊ |
166 | ␉unsigned long long __r17;␊ |
167 | ␉unsigned long long __r18;␊ |
168 | ␉unsigned long long __r19;␊ |
169 | ␉unsigned long long __r20;␊ |
170 | ␉unsigned long long __r21;␊ |
171 | ␉unsigned long long __r22;␊ |
172 | ␉unsigned long long __r23;␊ |
173 | ␉unsigned long long __r24;␊ |
174 | ␉unsigned long long __r25;␊ |
175 | ␉unsigned long long __r26;␊ |
176 | ␉unsigned long long __r27;␊ |
177 | ␉unsigned long long __r28;␊ |
178 | ␉unsigned long long __r29;␊ |
179 | ␉unsigned long long __r30;␊ |
180 | ␉unsigned long long __r31;␊ |
181 | ␊ |
182 | ␉unsigned int __cr;␉␉/* Condition register */␊ |
183 | ␉unsigned long long __xer;␉/* User's integer exception register */␊ |
184 | ␉unsigned long long __lr;␉/* Link register */␊ |
185 | ␉unsigned long long __ctr;␉/* Count register */␊ |
186 | ␊ |
187 | ␉unsigned int __vrsave;␉␉/* Vector Save Register */␊ |
188 | };␊ |
189 | #else /* !__DARWIN_UNIX03 */␊ |
190 | #define _STRUCT_PPC_THREAD_STATE64␉struct ppc_thread_state64␊ |
191 | _STRUCT_PPC_THREAD_STATE64␊ |
192 | {␊ |
193 | ␉unsigned long long srr0;␉/* Instruction address register (PC) */␊ |
194 | ␉unsigned long long srr1;␉/* Machine state register (supervisor) */␊ |
195 | ␉unsigned long long r0;␊ |
196 | ␉unsigned long long r1;␊ |
197 | ␉unsigned long long r2;␊ |
198 | ␉unsigned long long r3;␊ |
199 | ␉unsigned long long r4;␊ |
200 | ␉unsigned long long r5;␊ |
201 | ␉unsigned long long r6;␊ |
202 | ␉unsigned long long r7;␊ |
203 | ␉unsigned long long r8;␊ |
204 | ␉unsigned long long r9;␊ |
205 | ␉unsigned long long r10;␊ |
206 | ␉unsigned long long r11;␊ |
207 | ␉unsigned long long r12;␊ |
208 | ␉unsigned long long r13;␊ |
209 | ␉unsigned long long r14;␊ |
210 | ␉unsigned long long r15;␊ |
211 | ␉unsigned long long r16;␊ |
212 | ␉unsigned long long r17;␊ |
213 | ␉unsigned long long r18;␊ |
214 | ␉unsigned long long r19;␊ |
215 | ␉unsigned long long r20;␊ |
216 | ␉unsigned long long r21;␊ |
217 | ␉unsigned long long r22;␊ |
218 | ␉unsigned long long r23;␊ |
219 | ␉unsigned long long r24;␊ |
220 | ␉unsigned long long r25;␊ |
221 | ␉unsigned long long r26;␊ |
222 | ␉unsigned long long r27;␊ |
223 | ␉unsigned long long r28;␊ |
224 | ␉unsigned long long r29;␊ |
225 | ␉unsigned long long r30;␊ |
226 | ␉unsigned long long r31;␊ |
227 | ␊ |
228 | ␉unsigned int cr;␉␉/* Condition register */␊ |
229 | ␉unsigned long long xer;␉␉/* User's integer exception register */␊ |
230 | ␉unsigned long long lr;␉␉/* Link register */␊ |
231 | ␉unsigned long long ctr;␉␉/* Count register */␊ |
232 | ␊ |
233 | ␉unsigned int vrsave;␉␉/* Vector Save Register */␊ |
234 | };␊ |
235 | #endif /* __DARWIN_UNIX03 */␊ |
236 | ␊ |
237 | #pragma pack()␊ |
238 | ␊ |
239 | #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */␊ |
240 | ␊ |
241 | /* This structure should be double-word aligned for performance */␊ |
242 | ␊ |
243 | #if __DARWIN_UNIX03␊ |
244 | #define␉_STRUCT_PPC_FLOAT_STATE␉struct __darwin_ppc_float_state␊ |
245 | _STRUCT_PPC_FLOAT_STATE␊ |
246 | {␊ |
247 | ␉double __fpregs[32];␊ |
248 | ␊ |
249 | ␉unsigned int __fpscr_pad; /* fpscr is 64 bits, 32 bits of rubbish */␊ |
250 | ␉unsigned int __fpscr;␉/* floating point status register */␊ |
251 | };␊ |
252 | #else /* !__DARWIN_UNIX03 */␊ |
253 | #define␉_STRUCT_PPC_FLOAT_STATE␉struct ppc_float_state␊ |
254 | _STRUCT_PPC_FLOAT_STATE␊ |
255 | {␊ |
256 | ␉double fpregs[32];␊ |
257 | ␊ |
258 | ␉unsigned int fpscr_pad; /* fpscr is 64 bits, 32 bits of rubbish */␊ |
259 | ␉unsigned int fpscr;␉/* floating point status register */␊ |
260 | };␊ |
261 | #endif /* __DARWIN_UNIX03 */␊ |
262 | ␊ |
263 | #pragma pack(4)␉␉/* Make sure the structure stays as we defined it */␊ |
264 | ␊ |
265 | #if __DARWIN_UNIX03␊ |
266 | #define _STRUCT_PPC_VECTOR_STATE␉struct __darwin_ppc_vector_state␊ |
267 | _STRUCT_PPC_VECTOR_STATE␊ |
268 | {␊ |
269 | #if defined(__LP64__)␊ |
270 | ␉unsigned int␉__save_vr[32][4];␊ |
271 | ␉unsigned int␉__save_vscr[4];␊ |
272 | #else␊ |
273 | ␉unsigned long␉__save_vr[32][4];␊ |
274 | ␉unsigned long␉__save_vscr[4];␊ |
275 | #endif␊ |
276 | ␉unsigned int␉__save_pad5[4];␊ |
277 | ␉unsigned int␉__save_vrvalid;␉␉␉/* VRs that have been saved */␊ |
278 | ␉unsigned int␉__save_pad6[7];␊ |
279 | };␊ |
280 | #else /* !__DARWIN_UNIX03 */␊ |
281 | #define _STRUCT_PPC_VECTOR_STATE␉struct ppc_vector_state␊ |
282 | _STRUCT_PPC_VECTOR_STATE␊ |
283 | {␊ |
284 | #if defined(__LP64__)␊ |
285 | ␉unsigned int␉save_vr[32][4];␊ |
286 | ␉unsigned int␉save_vscr[4];␊ |
287 | #else␊ |
288 | ␉unsigned long␉save_vr[32][4];␊ |
289 | ␉unsigned long␉save_vscr[4];␊ |
290 | #endif␊ |
291 | ␉unsigned int␉save_pad5[4];␊ |
292 | ␉unsigned int␉save_vrvalid;␉␉␉/* VRs that have been saved */␊ |
293 | ␉unsigned int␉save_pad6[7];␊ |
294 | };␊ |
295 | #endif /* __DARWIN_UNIX03 */␊ |
296 | ␊ |
297 | #pragma pack()␊ |
298 | ␊ |
299 | /*␊ |
300 | * ppc_exception_state␊ |
301 | *␊ |
302 | * This structure corresponds to some additional state of the user␊ |
303 | * registers as saved in the PCB upon kernel entry. They are only␊ |
304 | * available if an exception is passed out of the kernel, and even␊ |
305 | * then not all are guaranteed to be updated.␊ |
306 | *␊ |
307 | * Some padding is included in this structure which allows space for␊ |
308 | * servers to store temporary values if need be, to maintain binary␊ |
309 | * compatiblity.␊ |
310 | */␊ |
311 | ␊ |
312 | /* Exception state for 32-bit thread (on 32-bit processor) */␊ |
313 | /* Still available on 64-bit processors, but may fall short */␊ |
314 | /* of covering the full potential state (hi half available). */␊ |
315 | ␊ |
316 | #pragma pack(4)␉/* Make sure the structure stays as we defined it */␊ |
317 | ␊ |
318 | #if __DARWIN_UNIX03␊ |
319 | #define _STRUCT_PPC_EXCEPTION_STATE␉struct __darwin_ppc_exception_state␊ |
320 | _STRUCT_PPC_EXCEPTION_STATE␊ |
321 | {␊ |
322 | #if defined(__LP64__)␊ |
323 | ␉unsigned int __dar;␉␉/* Fault registers for coredump */␊ |
324 | ␉unsigned int __dsisr;␊ |
325 | ␉unsigned int __exception;␉/* number of powerpc exception taken */␊ |
326 | ␉unsigned int __pad0;␉␉/* align to 16 bytes */␊ |
327 | ␉unsigned int __pad1[4];␉␉/* space in PCB "just in case" */␊ |
328 | #else␊ |
329 | ␉unsigned long __dar;␉␉/* Fault registers for coredump */␊ |
330 | ␉unsigned long __dsisr;␊ |
331 | ␉unsigned long __exception;␉/* number of powerpc exception taken */␊ |
332 | ␉unsigned long __pad0;␉␉/* align to 16 bytes */␊ |
333 | ␉unsigned long __pad1[4];␉/* space in PCB "just in case" */␊ |
334 | #endif␊ |
335 | };␊ |
336 | #else /* !__DARWIN_UNIX03 */␊ |
337 | #define _STRUCT_PPC_EXCEPTION_STATE␉struct ppc_exception_state␊ |
338 | _STRUCT_PPC_EXCEPTION_STATE␊ |
339 | {␊ |
340 | #if defined(__LP64__)␊ |
341 | ␉unsigned int dar;␉␉/* Fault registers for coredump */␊ |
342 | ␉unsigned int dsisr;␊ |
343 | ␉unsigned int exception;␉␉/* number of powerpc exception taken */␊ |
344 | ␉unsigned int pad0;␉␉/* align to 16 bytes */␊ |
345 | ␉unsigned int pad1[4];␉␉/* space in PCB "just in case" */␊ |
346 | #else␊ |
347 | ␉unsigned long dar;␉␉/* Fault registers for coredump */␊ |
348 | ␉unsigned long dsisr;␊ |
349 | ␉unsigned long exception;␉/* number of powerpc exception taken */␊ |
350 | ␉unsigned long pad0;␉␉/* align to 16 bytes */␊ |
351 | ␉unsigned long pad1[4];␉␉/* space in PCB "just in case" */␊ |
352 | #endif␊ |
353 | };␊ |
354 | #endif /* __DARWIN_UNIX03 */␊ |
355 | ␊ |
356 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)␊ |
357 | #if __DARWIN_UNIX03␊ |
358 | #define _STRUCT_PPC_EXCEPTION_STATE64␉struct __darwin_ppc_exception_state64␊ |
359 | _STRUCT_PPC_EXCEPTION_STATE64␊ |
360 | {␊ |
361 | ␉unsigned long long __dar;␉/* Fault registers for coredump */␊ |
362 | #if defined(__LP64__)␊ |
363 | ␉unsigned int __dsisr;␊ |
364 | ␉unsigned int __exception;␉/* number of powerpc exception taken */␊ |
365 | ␉unsigned int __pad1[4];␉/* space in PCB "just in case" */␊ |
366 | #else␊ |
367 | ␉unsigned long __dsisr;␊ |
368 | ␉unsigned long __exception;␉/* number of powerpc exception taken */␊ |
369 | ␉unsigned long __pad1[4];␉/* space in PCB "just in case" */␊ |
370 | #endif␊ |
371 | };␊ |
372 | #else /* !__DARWIN_UNIX03 */␊ |
373 | #define _STRUCT_PPC_EXCEPTION_STATE64␉struct ppc_exception_state64␊ |
374 | _STRUCT_PPC_EXCEPTION_STATE64␊ |
375 | {␊ |
376 | ␉unsigned long long dar;␉␉/* Fault registers for coredump */␊ |
377 | #if defined(__LP64__)␊ |
378 | ␉unsigned int dsisr;␊ |
379 | ␉unsigned int exception;␉/* number of powerpc exception taken */␊ |
380 | ␉unsigned int pad1[4];␉␉/* space in PCB "just in case" */␊ |
381 | #else␊ |
382 | ␉unsigned long dsisr;␊ |
383 | ␉unsigned long exception;␉/* number of powerpc exception taken */␊ |
384 | ␉unsigned long pad1[4];␉␉/* space in PCB "just in case" */␊ |
385 | #endif␊ |
386 | };␊ |
387 | #endif /* __DARWIN_UNIX03 */␊ |
388 | #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */␊ |
389 | ␊ |
390 | #pragma pack()␊ |
391 | ␊ |
392 | #endif /* _MACH_PPC__STRUCTS_H_ */␊ |
393 |