2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 #ifndef _MACH_PPC__STRUCTS_H_
33 #define _MACH_PPC__STRUCTS_H_
35 #include <sys/cdefs.h>
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.
44 #define _STRUCT_PPC_THREAD_STATE struct __darwin_ppc_thread_state
45 _STRUCT_PPC_THREAD_STATE
47 unsigned int __srr0
; /* Instruction address register (PC) */
48 unsigned int __srr1
; /* Machine state register (supervisor) */
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) */
88 unsigned int __vrsave
; /* Vector Save Register */
90 #else /* !__DARWIN_UNIX03 */
91 #define _STRUCT_PPC_THREAD_STATE struct ppc_thread_state
92 _STRUCT_PPC_THREAD_STATE
94 unsigned int srr0
; /* Instruction address register (PC) */
95 unsigned int srr1
; /* Machine state register (supervisor) */
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) */
135 unsigned int vrsave
; /* Vector Save Register */
137 #endif /* __DARWIN_UNIX03 */
139 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
141 #pragma pack(4) /* Make sure the structure stays as we defined it */
144 #define _STRUCT_PPC_THREAD_STATE64 struct __darwin_ppc_thread_state64
145 _STRUCT_PPC_THREAD_STATE64
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
;
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 */
187 unsigned int __vrsave
; /* Vector Save Register */
189 #else /* !__DARWIN_UNIX03 */
190 #define _STRUCT_PPC_THREAD_STATE64 struct ppc_thread_state64
191 _STRUCT_PPC_THREAD_STATE64
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
;
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 */
233 unsigned int vrsave
; /* Vector Save Register */
235 #endif /* __DARWIN_UNIX03 */
239 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
241 /* This structure should be double-word aligned for performance */
244 #define _STRUCT_PPC_FLOAT_STATE struct __darwin_ppc_float_state
245 _STRUCT_PPC_FLOAT_STATE
249 unsigned int __fpscr_pad
; /* fpscr is 64 bits, 32 bits of rubbish */
250 unsigned int __fpscr
; /* floating point status register */
252 #else /* !__DARWIN_UNIX03 */
253 #define _STRUCT_PPC_FLOAT_STATE struct ppc_float_state
254 _STRUCT_PPC_FLOAT_STATE
258 unsigned int fpscr_pad
; /* fpscr is 64 bits, 32 bits of rubbish */
259 unsigned int fpscr
; /* floating point status register */
261 #endif /* __DARWIN_UNIX03 */
263 #pragma pack(4) /* Make sure the structure stays as we defined it */
266 #define _STRUCT_PPC_VECTOR_STATE struct __darwin_ppc_vector_state
267 _STRUCT_PPC_VECTOR_STATE
269 #if defined(__LP64__)
270 unsigned int __save_vr
[32][4];
271 unsigned int __save_vscr
[4];
273 unsigned long __save_vr
[32][4];
274 unsigned long __save_vscr
[4];
276 unsigned int __save_pad5
[4];
277 unsigned int __save_vrvalid
; /* VRs that have been saved */
278 unsigned int __save_pad6
[7];
280 #else /* !__DARWIN_UNIX03 */
281 #define _STRUCT_PPC_VECTOR_STATE struct ppc_vector_state
282 _STRUCT_PPC_VECTOR_STATE
284 #if defined(__LP64__)
285 unsigned int save_vr
[32][4];
286 unsigned int save_vscr
[4];
288 unsigned long save_vr
[32][4];
289 unsigned long save_vscr
[4];
291 unsigned int save_pad5
[4];
292 unsigned int save_vrvalid
; /* VRs that have been saved */
293 unsigned int save_pad6
[7];
295 #endif /* __DARWIN_UNIX03 */
300 * ppc_exception_state
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.
307 * Some padding is included in this structure which allows space for
308 * servers to store temporary values if need be, to maintain binary
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). */
316 #pragma pack(4) /* Make sure the structure stays as we defined it */
319 #define _STRUCT_PPC_EXCEPTION_STATE struct __darwin_ppc_exception_state
320 _STRUCT_PPC_EXCEPTION_STATE
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" */
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" */
336 #else /* !__DARWIN_UNIX03 */
337 #define _STRUCT_PPC_EXCEPTION_STATE struct ppc_exception_state
338 _STRUCT_PPC_EXCEPTION_STATE
340 #if defined(__LP64__)
341 unsigned int dar
; /* Fault registers for coredump */
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" */
347 unsigned long dar
; /* Fault registers for coredump */
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" */
354 #endif /* __DARWIN_UNIX03 */
356 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
358 #define _STRUCT_PPC_EXCEPTION_STATE64 struct __darwin_ppc_exception_state64
359 _STRUCT_PPC_EXCEPTION_STATE64
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" */
367 unsigned long __dsisr
;
368 unsigned long __exception
; /* number of powerpc exception taken */
369 unsigned long __pad1
[4]; /* space in PCB "just in case" */
372 #else /* !__DARWIN_UNIX03 */
373 #define _STRUCT_PPC_EXCEPTION_STATE64 struct ppc_exception_state64
374 _STRUCT_PPC_EXCEPTION_STATE64
376 unsigned long long dar
; /* Fault registers for coredump */
377 #if defined(__LP64__)
379 unsigned int exception
; /* number of powerpc exception taken */
380 unsigned int pad1
[4]; /* space in PCB "just in case" */
383 unsigned long exception
; /* number of powerpc exception taken */
384 unsigned long pad1
[4]; /* space in PCB "just in case" */
387 #endif /* __DARWIN_UNIX03 */
388 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
392 #endif /* _MACH_PPC__STRUCTS_H_ */