]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/ppc/_types.h
098c1670a9340c58d49933e6cb6904e98b15af61
[apple/xnu.git] / osfmk / mach / ppc / _types.h
1 /*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25
26 #ifndef _MACH_PPC__TYPES_H_
27 #define _MACH_PPC__TYPES_H_
28
29 /*
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.
32 *
33 */
34
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 */
40 {
41 unsigned int srr0; /* Instruction address register (PC) */
42 unsigned int srr1; /* Machine state register (supervisor) */
43 unsigned int r0;
44 unsigned int r1;
45 unsigned int r2;
46 unsigned int r3;
47 unsigned int r4;
48 unsigned int r5;
49 unsigned int r6;
50 unsigned int r7;
51 unsigned int r8;
52 unsigned int r9;
53 unsigned int r10;
54 unsigned int r11;
55 unsigned int r12;
56 unsigned int r13;
57 unsigned int r14;
58 unsigned int r15;
59 unsigned int r16;
60 unsigned int r17;
61 unsigned int r18;
62 unsigned int r19;
63 unsigned int r20;
64 unsigned int r21;
65 unsigned int r22;
66 unsigned int r23;
67 unsigned int r24;
68 unsigned int r25;
69 unsigned int r26;
70 unsigned int r27;
71 unsigned int r28;
72 unsigned int r29;
73 unsigned int r30;
74 unsigned int r31;
75
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) */
81
82 unsigned int vrsave; /* Vector Save Register */
83 };
84
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;
122
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 */
127
128 unsigned int vrsave; /* Vector Save Register */
129 };
130
131 #pragma pack()
132 #endif /* _POSIX_C_SOURCE */
133
134 /* This structure should be double-word aligned for performance */
135
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 */
141 {
142 double fpregs[32];
143
144 unsigned int fpscr_pad; /* fpscr is 64 bits, 32 bits of rubbish */
145 unsigned int fpscr; /* floating point status register */
146 };
147
148 #pragma pack(4) /* Make sure the structure stays as we defined it */
149
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 */
155 {
156 #if defined(__LP64__)
157 unsigned int save_vr[32][4];
158 unsigned int save_vscr[4];
159 #else
160 unsigned long save_vr[32][4];
161 unsigned long save_vscr[4];
162 #endif
163 unsigned int save_pad5[4];
164 unsigned int save_vrvalid; /* VRs that have been saved */
165 unsigned int save_pad6[7];
166 };
167 #pragma pack()
168
169 /*
170 * ppc_exception_state
171 *
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.
176 *
177 * Some padding is included in this structure which allows space for
178 * servers to store temporary values if need be, to maintain binary
179 * compatiblity.
180 */
181
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). */
185
186 #pragma pack(4) /* Make sure the structure stays as we defined it */
187
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 */
193 {
194 #if defined(__LP64__)
195 unsigned int dar; /* Fault registers for coredump */
196 unsigned int dsisr;
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" */
200 #else
201 unsigned long dar; /* Fault registers for coredump */
202 unsigned long dsisr;
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" */
206 #endif
207 };
208
209 #ifndef _POSIX_C_SOURCE
210 struct ppc_exception_state64 {
211 unsigned long long dar; /* Fault registers for coredump */
212 #if defined(__LP64__)
213 unsigned int dsisr;
214 unsigned int exception; /* number of powerpc exception taken */
215 unsigned int pad1[4]; /* space in PCB "just in case" */
216 #else
217 unsigned long dsisr;
218 unsigned long exception; /* number of powerpc exception taken */
219 unsigned long pad1[4]; /* space in PCB "just in case" */
220 #endif
221 };
222 #endif /* _POSIX_C_SOURCE */
223
224 #pragma pack()
225
226 #endif /* _MACH_PPC__TYPES_H_ */