2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 #ifndef _MACH_PPC__TYPES_H_
27 #define _MACH_PPC__TYPES_H_
30 * ppc_thread_state is the structure that is exported to user threads for
31 * use in status/mutate calls. This structure should never change.
35 #ifndef _POSIX_C_SOURCE
36 struct ppc_thread_state
37 #else /* _POSIX_C_SOURCE */
38 struct __darwin_ppc_thread_state
39 #endif /* _POSIX_C_SOURCE */
41 unsigned int srr0
; /* Instruction address register (PC) */
42 unsigned int srr1
; /* Machine state register (supervisor) */
76 unsigned int cr
; /* Condition register */
77 unsigned int xer
; /* User's integer exception register */
78 unsigned int lr
; /* Link register */
79 unsigned int ctr
; /* Count register */
80 unsigned int mq
; /* MQ register (601 only) */
82 unsigned int vrsave
; /* Vector Save Register */
85 #ifndef _POSIX_C_SOURCE
86 #pragma pack(4) /* Make sure the structure stays as we defined it */
87 struct ppc_thread_state64
{
88 unsigned long long srr0
; /* Instruction address register (PC) */
89 unsigned long long srr1
; /* Machine state register (supervisor) */
90 unsigned long long r0
;
91 unsigned long long r1
;
92 unsigned long long r2
;
93 unsigned long long r3
;
94 unsigned long long r4
;
95 unsigned long long r5
;
96 unsigned long long r6
;
97 unsigned long long r7
;
98 unsigned long long r8
;
99 unsigned long long r9
;
100 unsigned long long r10
;
101 unsigned long long r11
;
102 unsigned long long r12
;
103 unsigned long long r13
;
104 unsigned long long r14
;
105 unsigned long long r15
;
106 unsigned long long r16
;
107 unsigned long long r17
;
108 unsigned long long r18
;
109 unsigned long long r19
;
110 unsigned long long r20
;
111 unsigned long long r21
;
112 unsigned long long r22
;
113 unsigned long long r23
;
114 unsigned long long r24
;
115 unsigned long long r25
;
116 unsigned long long r26
;
117 unsigned long long r27
;
118 unsigned long long r28
;
119 unsigned long long r29
;
120 unsigned long long r30
;
121 unsigned long long r31
;
123 unsigned int cr
; /* Condition register */
124 unsigned long long xer
; /* User's integer exception register */
125 unsigned long long lr
; /* Link register */
126 unsigned long long ctr
; /* Count register */
128 unsigned int vrsave
; /* Vector Save Register */
132 #endif /* _POSIX_C_SOURCE */
134 /* This structure should be double-word aligned for performance */
136 #ifndef _POSIX_C_SOURCE
137 struct ppc_float_state
138 #else /* _POSIX_C_SOURCE */
139 struct __darwin_ppc_float_state
140 #endif /* _POSIX_C_SOURCE */
144 unsigned int fpscr_pad
; /* fpscr is 64 bits, 32 bits of rubbish */
145 unsigned int fpscr
; /* floating point status register */
148 #pragma pack(4) /* Make sure the structure stays as we defined it */
150 #ifndef _POSIX_C_SOURCE
151 struct ppc_vector_state
152 #else /* _POSIX_C_SOURCE */
153 struct __darwin_ppc_vector_state
154 #endif /* _POSIX_C_SOURCE */
156 #if defined(__LP64__)
157 unsigned int save_vr
[32][4];
158 unsigned int save_vscr
[4];
160 unsigned long save_vr
[32][4];
161 unsigned long save_vscr
[4];
163 unsigned int save_pad5
[4];
164 unsigned int save_vrvalid
; /* VRs that have been saved */
165 unsigned int save_pad6
[7];
170 * ppc_exception_state
172 * This structure corresponds to some additional state of the user
173 * registers as saved in the PCB upon kernel entry. They are only
174 * available if an exception is passed out of the kernel, and even
175 * then not all are guaranteed to be updated.
177 * Some padding is included in this structure which allows space for
178 * servers to store temporary values if need be, to maintain binary
182 /* Exception state for 32-bit thread (on 32-bit processor) */
183 /* Still available on 64-bit processors, but may fall short */
184 /* of covering the full potential state (hi half available). */
186 #pragma pack(4) /* Make sure the structure stays as we defined it */
188 #ifndef _POSIX_C_SOURCE
189 struct ppc_exception_state
190 #else /* _POSIX_C_SOURCE */
191 struct __darwin_ppc_exception_state
192 #endif /* _POSIX_C_SOURCE */
194 #if defined(__LP64__)
195 unsigned int dar
; /* Fault registers for coredump */
197 unsigned int exception
; /* number of powerpc exception taken */
198 unsigned int pad0
; /* align to 16 bytes */
199 unsigned int pad1
[4]; /* space in PCB "just in case" */
201 unsigned long dar
; /* Fault registers for coredump */
203 unsigned long exception
; /* number of powerpc exception taken */
204 unsigned long pad0
; /* align to 16 bytes */
205 unsigned long pad1
[4]; /* space in PCB "just in case" */
209 #ifndef _POSIX_C_SOURCE
210 struct ppc_exception_state64
{
211 unsigned long long dar
; /* Fault registers for coredump */
212 #if defined(__LP64__)
214 unsigned int exception
; /* number of powerpc exception taken */
215 unsigned int pad1
[4]; /* space in PCB "just in case" */
218 unsigned long exception
; /* number of powerpc exception taken */
219 unsigned long pad1
[4]; /* space in PCB "just in case" */
222 #endif /* _POSIX_C_SOURCE */
226 #endif /* _MACH_PPC__TYPES_H_ */