]> git.saurik.com Git - apple/xnu.git/blame_incremental - bsd/ppc/_structs.h
xnu-1504.15.3.tar.gz
[apple/xnu.git] / bsd / ppc / _structs.h
... / ...
CommitLineData
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
101typedef _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
109typedef _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 * For now, just duplicate the 32-bit context as the generic one.
124 */
125#ifdef __need_struct_sigcontext
126#undef __need_struct_sigcontext
127#ifndef _STRUCT_SIGCONTEXT
128#if __DARWIN_UNIX03 /* signal.h needs struct sigcontext visible */
129#define _STRUCT_SIGCONTEXT struct __darwin_sigcontext
130_STRUCT_SIGCONTEXT
131{
132 int __sc_onstack; /* sigstack state to restore */
133 int __sc_mask; /* signal mask to restore */
134 int __sc_ir; /* pc */
135 int __sc_psw; /* processor status word */
136 int __sc_sp; /* stack pointer if sc_regs == NULL */
137 void *__sc_regs; /* (kernel private) saved state */
138};
139#else /* !__DARWIN_UNIX03 */
140#define _STRUCT_SIGCONTEXT struct sigcontext
141_STRUCT_SIGCONTEXT
142{
143 int sc_onstack; /* sigstack state to restore */
144 int sc_mask; /* signal mask to restore */
145 int sc_ir; /* pc */
146 int sc_psw; /* processor status word */
147 int sc_sp; /* stack pointer if sc_regs == NULL */
148 void *sc_regs; /* (kernel private) saved state */
149};
150#endif /* __DARWIN_UNIX03 */
151#endif /* _STRUCT_SIGCONTEXT */
152#endif /* __need_struct_sigcontext */
153
154/*
155 * Information pushed on stack when a signal is delivered.
156 * This is used by the kernel to restore state following
157 * execution of the signal handler. It is also made available
158 * to the handler to allow it to properly restore state if
159 * a non-standard exit is performed.
160 */
161#ifdef __need_struct_sigcontext32
162#undef __need_struct_sigcontext32
163#ifndef _STRUCT_SIGCONTEXT32
164#if __DARWIN_UNIX03
165#define _STRUCT_SIGCONTEXT32 struct __darwin_sigcontext32
166_STRUCT_SIGCONTEXT32
167{
168 int __sc_onstack; /* sigstack state to restore */
169 int __sc_mask; /* signal mask to restore */
170 int __sc_ir; /* pc */
171 int __sc_psw; /* processor status word */
172 int __sc_sp; /* stack pointer if sc_regs == NULL */
173 void *__sc_regs; /* (kernel private) saved state */
174};
175#else /* !__DARWIN_UNIX03 */
176#define _STRUCT_SIGCONTEXT32 struct sigcontext32
177_STRUCT_SIGCONTEXT32
178{
179 int sc_onstack; /* sigstack state to restore */
180 int sc_mask; /* signal mask to restore */
181 int sc_ir; /* pc */
182 int sc_psw; /* processor status word */
183 int sc_sp; /* stack pointer if sc_regs == NULL */
184 void *sc_regs; /* (kernel private) saved state */
185};
186#endif /* __DARWIN_UNIX03 */
187#endif /* _STRUCT_SIGCONTEXT32 */
188#endif /* __need_struct_sigcontext32 */
189
190#ifdef __need_struct_sigcontext64
191#undef __need_struct_sigcontext64
192#ifndef _STRUCT_SIGCONTEXT64
193#if __DARWIN_UNIX03
194#define _STRUCT_SIGCONTEXT64 struct __darwin_sigcontext64
195_STRUCT_SIGCONTEXT64
196{
197 int __sc_onstack; /* sigstack state to restore */
198 int __sc_mask; /* signal mask to restore */
199 long long __sc_ir; /* pc */
200 long long __sc_psw; /* processor status word */
201 long long __sc_sp; /* stack pointer if sc_regs == NULL */
202 void *__sc_regs; /* (kernel private) saved state */
203};
204#else /* !__DARWIN_UNIX03 */
205#define _STRUCT_SIGCONTEXT64 struct sigcontext64
206_STRUCT_SIGCONTEXT64
207{
208 int sc_onstack; /* sigstack state to restore */
209 int sc_mask; /* signal mask to restore */
210 long long sc_ir; /* pc */
211 long long sc_psw; /* processor status word */
212 long long sc_sp; /* stack pointer if sc_regs == NULL */
213 void *sc_regs; /* (kernel private) saved state */
214};
215#endif /* __DARWIN_UNIX03 */
216#endif /* _STRUCT_SIGCONTEXT64 */
217#endif /* __need_struct_sigcontext64 */