]> git.saurik.com Git - apple/xnu.git/blob - bsd/ppc/_structs.h
xnu-1228.15.4.tar.gz
[apple/xnu.git] / bsd / ppc / _structs.h
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 #include <sys/cdefs.h>
30
31 #ifdef __need_mcontext_t
32 #ifndef __need_struct_mcontext
33 #define __need_struct_mcontext
34 #endif /* __need_struct_mcontext */
35 #endif /* __need_mcontext_t */
36
37 #ifdef __need_mcontext64_t
38 #ifndef __need_struct_mcontext64
39 #define __need_struct_mcontext64
40 #endif /* __need_struct_mcontext64 */
41 #endif /* __need_mcontext64_t */
42
43 #if defined(__need_struct_mcontext) || defined(__need_struct_mcontext64)
44 #include <mach/ppc/_structs.h>
45 #endif /* __need_struct_mcontext || __need_struct_mcontext64 */
46
47 #ifdef __need_struct_mcontext
48 #undef __need_struct_mcontext
49 #ifndef _STRUCT_MCONTEXT
50 #if __DARWIN_UNIX03
51 #define _STRUCT_MCONTEXT struct __darwin_mcontext
52 _STRUCT_MCONTEXT
53 {
54 _STRUCT_PPC_EXCEPTION_STATE __es;
55 _STRUCT_PPC_THREAD_STATE __ss;
56 _STRUCT_PPC_FLOAT_STATE __fs;
57 _STRUCT_PPC_VECTOR_STATE __vs;
58 };
59 #else /* !__DARWIN_UNIX03 */
60 #define _STRUCT_MCONTEXT struct mcontext
61 _STRUCT_MCONTEXT
62 {
63 _STRUCT_PPC_EXCEPTION_STATE es;
64 _STRUCT_PPC_THREAD_STATE ss;
65 _STRUCT_PPC_FLOAT_STATE fs;
66 _STRUCT_PPC_VECTOR_STATE vs;
67 };
68 #endif /* __DARWIN_UNIX03 */
69 #endif /* _STRUCT_MCONTEXT */
70 #endif /* __need_struct_mcontext */
71
72 #ifdef __need_struct_mcontext64
73 #undef __need_struct_mcontext64
74 #ifndef _STRUCT_MCONTEXT64
75 #if __DARWIN_UNIX03
76 #define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
77 _STRUCT_MCONTEXT64
78 {
79 _STRUCT_PPC_EXCEPTION_STATE64 __es;
80 _STRUCT_PPC_THREAD_STATE64 __ss;
81 _STRUCT_PPC_FLOAT_STATE __fs;
82 _STRUCT_PPC_VECTOR_STATE __vs;
83 };
84 #else /* !__DARWIN_UNIX03 */
85 #define _STRUCT_MCONTEXT64 struct mcontext64
86 _STRUCT_MCONTEXT64
87 {
88 _STRUCT_PPC_EXCEPTION_STATE64 es;
89 _STRUCT_PPC_THREAD_STATE64 ss;
90 _STRUCT_PPC_FLOAT_STATE fs;
91 _STRUCT_PPC_VECTOR_STATE vs;
92 };
93 #endif /* __DARWIN_UNIX03 */
94 #endif /* _STRUCT_MCONTEXT64 */
95 #endif /* __need_struct_mcontext64 */
96
97 #ifdef __need_mcontext_t
98 #undef __need_mcontext_t
99 #ifndef _MCONTEXT_T
100 #define _MCONTEXT_T
101 typedef _STRUCT_MCONTEXT *mcontext_t;
102 #endif /* _MCONTEXT_T */
103 #endif /* __need_mcontext_t */
104
105 #ifdef __need_mcontext64_t
106 #undef __need_mcontext64_t
107 #ifndef _MCONTEXT64_T
108 #define _MCONTEXT64_T
109 typedef _STRUCT_MCONTEXT64 *mcontext64_t;
110 #endif /* _MCONTEXT64_T */
111 #endif /* __need_mcontext64_t */
112
113 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
114 #ifndef PPC_MCONTEXT_SIZE
115 #define PPC_MCONTEXT_SIZE (PPC_THREAD_STATE_COUNT + PPC_FLOAT_STATE_COUNT + PPC_EXCEPTION_STATE_COUNT + PPC_VECTOR_STATE_COUNT) * sizeof(int)
116 #endif /* PPC_MCONTEXT_SIZE */
117 #ifndef PPC_MCONTEXT64_SIZE
118 #define PPC_MCONTEXT64_SIZE (PPC_THREAD_STATE64_COUNT + PPC_FLOAT_STATE_COUNT + PPC_EXCEPTION_STATE_COUNT + PPC_VECTOR_STATE_COUNT) * sizeof(int)
119 #endif /* PPC_MCONTEXT64_SIZE */
120 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
121
122 /*
123 * LP64todo - Have to decide how to handle this.
124 * For now, just duplicate the 32-bit context as the generic one.
125 */
126 #ifdef __need_struct_sigcontext
127 #undef __need_struct_sigcontext
128 #ifndef _STRUCT_SIGCONTEXT
129 #if __DARWIN_UNIX03 /* signal.h needs struct sigcontext visible */
130 #define _STRUCT_SIGCONTEXT struct __darwin_sigcontext
131 _STRUCT_SIGCONTEXT
132 {
133 int __sc_onstack; /* sigstack state to restore */
134 int __sc_mask; /* signal mask to restore */
135 int __sc_ir; /* pc */
136 int __sc_psw; /* processor status word */
137 int __sc_sp; /* stack pointer if sc_regs == NULL */
138 void *__sc_regs; /* (kernel private) saved state */
139 };
140 #else /* !__DARWIN_UNIX03 */
141 #define _STRUCT_SIGCONTEXT struct sigcontext
142 _STRUCT_SIGCONTEXT
143 {
144 int sc_onstack; /* sigstack state to restore */
145 int sc_mask; /* signal mask to restore */
146 int sc_ir; /* pc */
147 int sc_psw; /* processor status word */
148 int sc_sp; /* stack pointer if sc_regs == NULL */
149 void *sc_regs; /* (kernel private) saved state */
150 };
151 #endif /* __DARWIN_UNIX03 */
152 #endif /* _STRUCT_SIGCONTEXT */
153 #endif /* __need_struct_sigcontext */
154
155 /*
156 * Information pushed on stack when a signal is delivered.
157 * This is used by the kernel to restore state following
158 * execution of the signal handler. It is also made available
159 * to the handler to allow it to properly restore state if
160 * a non-standard exit is performed.
161 */
162 #ifdef __need_struct_sigcontext32
163 #undef __need_struct_sigcontext32
164 #ifndef _STRUCT_SIGCONTEXT32
165 #if __DARWIN_UNIX03
166 #define _STRUCT_SIGCONTEXT32 struct __darwin_sigcontext32
167 _STRUCT_SIGCONTEXT32
168 {
169 int __sc_onstack; /* sigstack state to restore */
170 int __sc_mask; /* signal mask to restore */
171 int __sc_ir; /* pc */
172 int __sc_psw; /* processor status word */
173 int __sc_sp; /* stack pointer if sc_regs == NULL */
174 void *__sc_regs; /* (kernel private) saved state */
175 };
176 #else /* !__DARWIN_UNIX03 */
177 #define _STRUCT_SIGCONTEXT32 struct sigcontext32
178 _STRUCT_SIGCONTEXT32
179 {
180 int sc_onstack; /* sigstack state to restore */
181 int sc_mask; /* signal mask to restore */
182 int sc_ir; /* pc */
183 int sc_psw; /* processor status word */
184 int sc_sp; /* stack pointer if sc_regs == NULL */
185 void *sc_regs; /* (kernel private) saved state */
186 };
187 #endif /* __DARWIN_UNIX03 */
188 #endif /* _STRUCT_SIGCONTEXT32 */
189 #endif /* __need_struct_sigcontext32 */
190
191 #ifdef __need_struct_sigcontext64
192 #undef __need_struct_sigcontext64
193 #ifndef _STRUCT_SIGCONTEXT64
194 #if __DARWIN_UNIX03
195 #define _STRUCT_SIGCONTEXT64 struct __darwin_sigcontext64
196 _STRUCT_SIGCONTEXT64
197 {
198 int __sc_onstack; /* sigstack state to restore */
199 int __sc_mask; /* signal mask to restore */
200 long long __sc_ir; /* pc */
201 long long __sc_psw; /* processor status word */
202 long long __sc_sp; /* stack pointer if sc_regs == NULL */
203 void *__sc_regs; /* (kernel private) saved state */
204 };
205 #else /* !__DARWIN_UNIX03 */
206 #define _STRUCT_SIGCONTEXT64 struct sigcontext64
207 _STRUCT_SIGCONTEXT64
208 {
209 int sc_onstack; /* sigstack state to restore */
210 int sc_mask; /* signal mask to restore */
211 long long sc_ir; /* pc */
212 long long sc_psw; /* processor status word */
213 long long sc_sp; /* stack pointer if sc_regs == NULL */
214 void *sc_regs; /* (kernel private) saved state */
215 };
216 #endif /* __DARWIN_UNIX03 */
217 #endif /* _STRUCT_SIGCONTEXT64 */
218 #endif /* __need_struct_sigcontext64 */