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@
29 #include <sys/cdefs.h>
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 */
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 */
43 #if defined(__need_struct_mcontext) || defined(__need_struct_mcontext64)
44 #include <mach/ppc/_structs.h>
45 #endif /* __need_struct_mcontext || __need_struct_mcontext64 */
47 #ifdef __need_struct_mcontext
48 #undef __need_struct_mcontext
49 #ifndef _STRUCT_MCONTEXT
51 #define _STRUCT_MCONTEXT struct __darwin_mcontext
54 _STRUCT_PPC_EXCEPTION_STATE __es
;
55 _STRUCT_PPC_THREAD_STATE __ss
;
56 _STRUCT_PPC_FLOAT_STATE __fs
;
57 _STRUCT_PPC_VECTOR_STATE __vs
;
59 #else /* !__DARWIN_UNIX03 */
60 #define _STRUCT_MCONTEXT struct mcontext
63 _STRUCT_PPC_EXCEPTION_STATE es
;
64 _STRUCT_PPC_THREAD_STATE ss
;
65 _STRUCT_PPC_FLOAT_STATE fs
;
66 _STRUCT_PPC_VECTOR_STATE vs
;
68 #endif /* __DARWIN_UNIX03 */
69 #endif /* _STRUCT_MCONTEXT */
70 #endif /* __need_struct_mcontext */
72 #ifdef __need_struct_mcontext64
73 #undef __need_struct_mcontext64
74 #ifndef _STRUCT_MCONTEXT64
76 #define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
79 _STRUCT_PPC_EXCEPTION_STATE64 __es
;
80 _STRUCT_PPC_THREAD_STATE64 __ss
;
81 _STRUCT_PPC_FLOAT_STATE __fs
;
82 _STRUCT_PPC_VECTOR_STATE __vs
;
84 #else /* !__DARWIN_UNIX03 */
85 #define _STRUCT_MCONTEXT64 struct mcontext64
88 _STRUCT_PPC_EXCEPTION_STATE64 es
;
89 _STRUCT_PPC_THREAD_STATE64 ss
;
90 _STRUCT_PPC_FLOAT_STATE fs
;
91 _STRUCT_PPC_VECTOR_STATE vs
;
93 #endif /* __DARWIN_UNIX03 */
94 #endif /* _STRUCT_MCONTEXT64 */
95 #endif /* __need_struct_mcontext64 */
97 #ifdef __need_mcontext_t
98 #undef __need_mcontext_t
101 typedef _STRUCT_MCONTEXT
*mcontext_t
;
102 #endif /* _MCONTEXT_T */
103 #endif /* __need_mcontext_t */
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 */
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) */
123 * LP64todo - Have to decide how to handle this.
124 * For now, just duplicate the 32-bit context as the generic one.
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
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 */
140 #else /* !__DARWIN_UNIX03 */
141 #define _STRUCT_SIGCONTEXT struct sigcontext
144 int sc_onstack
; /* sigstack state to restore */
145 int sc_mask
; /* signal mask to restore */
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 */
151 #endif /* __DARWIN_UNIX03 */
152 #endif /* _STRUCT_SIGCONTEXT */
153 #endif /* __need_struct_sigcontext */
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.
162 #ifdef __need_struct_sigcontext32
163 #undef __need_struct_sigcontext32
164 #ifndef _STRUCT_SIGCONTEXT32
166 #define _STRUCT_SIGCONTEXT32 struct __darwin_sigcontext32
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 */
176 #else /* !__DARWIN_UNIX03 */
177 #define _STRUCT_SIGCONTEXT32 struct sigcontext32
180 int sc_onstack
; /* sigstack state to restore */
181 int sc_mask
; /* signal mask to restore */
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 */
187 #endif /* __DARWIN_UNIX03 */
188 #endif /* _STRUCT_SIGCONTEXT32 */
189 #endif /* __need_struct_sigcontext32 */
191 #ifdef __need_struct_sigcontext64
192 #undef __need_struct_sigcontext64
193 #ifndef _STRUCT_SIGCONTEXT64
195 #define _STRUCT_SIGCONTEXT64 struct __darwin_sigcontext64
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 */
205 #else /* !__DARWIN_UNIX03 */
206 #define _STRUCT_SIGCONTEXT64 struct sigcontext64
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 */
216 #endif /* __DARWIN_UNIX03 */
217 #endif /* _STRUCT_SIGCONTEXT64 */
218 #endif /* __need_struct_sigcontext64 */