]> git.saurik.com Git - apple/xnu.git/blob - bsd/i386/_mcontext.h
xnu-7195.101.1.tar.gz
[apple/xnu.git] / bsd / i386 / _mcontext.h
1 /*
2 * Copyright (c) 2003-2012 Apple 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 #ifndef __I386_MCONTEXT_H_
30 #define __I386_MCONTEXT_H_
31
32 #include <sys/cdefs.h> /* __DARWIN_UNIX03 */
33 #include <sys/appleapiopts.h>
34 #include <mach/machine/_structs.h>
35
36 #ifndef _STRUCT_MCONTEXT32
37 #if __DARWIN_UNIX03
38 #define _STRUCT_MCONTEXT32 struct __darwin_mcontext32
39 _STRUCT_MCONTEXT32
40 {
41 _STRUCT_X86_EXCEPTION_STATE32 __es;
42 _STRUCT_X86_THREAD_STATE32 __ss;
43 _STRUCT_X86_FLOAT_STATE32 __fs;
44 };
45
46 #define _STRUCT_MCONTEXT_AVX32 struct __darwin_mcontext_avx32
47 _STRUCT_MCONTEXT_AVX32
48 {
49 _STRUCT_X86_EXCEPTION_STATE32 __es;
50 _STRUCT_X86_THREAD_STATE32 __ss;
51 _STRUCT_X86_AVX_STATE32 __fs;
52 };
53
54 #if defined(_STRUCT_X86_AVX512_STATE32)
55 #define _STRUCT_MCONTEXT_AVX512_32 struct __darwin_mcontext_avx512_32
56 _STRUCT_MCONTEXT_AVX512_32
57 {
58 _STRUCT_X86_EXCEPTION_STATE32 __es;
59 _STRUCT_X86_THREAD_STATE32 __ss;
60 _STRUCT_X86_AVX512_STATE32 __fs;
61 };
62 #endif /* _STRUCT_X86_AVX512_STATE32 */
63
64 #else /* !__DARWIN_UNIX03 */
65 #define _STRUCT_MCONTEXT32 struct mcontext32
66 _STRUCT_MCONTEXT32
67 {
68 _STRUCT_X86_EXCEPTION_STATE32 es;
69 _STRUCT_X86_THREAD_STATE32 ss;
70 _STRUCT_X86_FLOAT_STATE32 fs;
71 };
72
73 #define _STRUCT_MCONTEXT_AVX32 struct mcontext_avx32
74 _STRUCT_MCONTEXT_AVX32
75 {
76 _STRUCT_X86_EXCEPTION_STATE32 es;
77 _STRUCT_X86_THREAD_STATE32 ss;
78 _STRUCT_X86_AVX_STATE32 fs;
79 };
80
81 #if defined(_STRUCT_X86_AVX512_STATE32)
82 #define _STRUCT_MCONTEXT_AVX512_32 struct mcontext_avx512_32
83 _STRUCT_MCONTEXT_AVX512_32
84 {
85 _STRUCT_X86_EXCEPTION_STATE32 es;
86 _STRUCT_X86_THREAD_STATE32 ss;
87 _STRUCT_X86_AVX512_STATE32 fs;
88 };
89 #endif /* _STRUCT_X86_AVX512_STATE32 */
90
91 #endif /* __DARWIN_UNIX03 */
92 #endif /* _STRUCT_MCONTEXT32 */
93
94 #ifndef _STRUCT_MCONTEXT64
95 #if __DARWIN_UNIX03
96 #define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
97 _STRUCT_MCONTEXT64
98 {
99 _STRUCT_X86_EXCEPTION_STATE64 __es;
100 _STRUCT_X86_THREAD_STATE64 __ss;
101 _STRUCT_X86_FLOAT_STATE64 __fs;
102 };
103
104 #define _STRUCT_MCONTEXT64_FULL struct __darwin_mcontext64_full
105 _STRUCT_MCONTEXT64_FULL
106 {
107 _STRUCT_X86_EXCEPTION_STATE64 __es;
108 _STRUCT_X86_THREAD_FULL_STATE64 __ss;
109 _STRUCT_X86_FLOAT_STATE64 __fs;
110 };
111
112 #define _STRUCT_MCONTEXT_AVX64 struct __darwin_mcontext_avx64
113 _STRUCT_MCONTEXT_AVX64
114 {
115 _STRUCT_X86_EXCEPTION_STATE64 __es;
116 _STRUCT_X86_THREAD_STATE64 __ss;
117 _STRUCT_X86_AVX_STATE64 __fs;
118 };
119
120 #define _STRUCT_MCONTEXT_AVX64_FULL struct __darwin_mcontext_avx64_full
121 _STRUCT_MCONTEXT_AVX64_FULL
122 {
123 _STRUCT_X86_EXCEPTION_STATE64 __es;
124 _STRUCT_X86_THREAD_FULL_STATE64 __ss;
125 _STRUCT_X86_AVX_STATE64 __fs;
126 };
127
128 #if defined(_STRUCT_X86_AVX512_STATE64)
129 #define _STRUCT_MCONTEXT_AVX512_64 struct __darwin_mcontext_avx512_64
130 _STRUCT_MCONTEXT_AVX512_64
131 {
132 _STRUCT_X86_EXCEPTION_STATE64 __es;
133 _STRUCT_X86_THREAD_STATE64 __ss;
134 _STRUCT_X86_AVX512_STATE64 __fs;
135 };
136
137 #define _STRUCT_MCONTEXT_AVX512_64_FULL struct __darwin_mcontext_avx512_64_full
138 _STRUCT_MCONTEXT_AVX512_64_FULL
139 {
140 _STRUCT_X86_EXCEPTION_STATE64 __es;
141 _STRUCT_X86_THREAD_FULL_STATE64 __ss;
142 _STRUCT_X86_AVX512_STATE64 __fs;
143 };
144 #endif /* _STRUCT_X86_AVX512_STATE64 */
145
146 #else /* !__DARWIN_UNIX03 */
147 #define _STRUCT_MCONTEXT64 struct mcontext64
148 _STRUCT_MCONTEXT64
149 {
150 _STRUCT_X86_EXCEPTION_STATE64 es;
151 _STRUCT_X86_THREAD_STATE64 ss;
152 _STRUCT_X86_FLOAT_STATE64 fs;
153 };
154
155 #define _STRUCT_MCONTEXT64_FULL struct mcontext64_full
156 _STRUCT_MCONTEXT64_FULL
157 {
158 _STRUCT_X86_EXCEPTION_STATE64 es;
159 _STRUCT_X86_THREAD_FULL_STATE64 ss;
160 _STRUCT_X86_FLOAT_STATE64 fs;
161 };
162
163 #define _STRUCT_MCONTEXT_AVX64 struct mcontext_avx64
164 _STRUCT_MCONTEXT_AVX64
165 {
166 _STRUCT_X86_EXCEPTION_STATE64 es;
167 _STRUCT_X86_THREAD_STATE64 ss;
168 _STRUCT_X86_AVX_STATE64 fs;
169 };
170
171 #define _STRUCT_MCONTEXT_AVX64_FULL struct mcontext_avx64_full
172 _STRUCT_MCONTEXT_AVX64_FULL
173 {
174 _STRUCT_X86_EXCEPTION_STATE64 es;
175 _STRUCT_X86_THREAD_FULL_STATE64 ss;
176 _STRUCT_X86_AVX_STATE64 fs;
177 };
178
179 #if defined(_STRUCT_X86_AVX512_STATE64)
180 #define _STRUCT_MCONTEXT_AVX512_64 struct mcontext_avx512_64
181 _STRUCT_MCONTEXT_AVX512_64
182 {
183 _STRUCT_X86_EXCEPTION_STATE64 es;
184 _STRUCT_X86_THREAD_STATE64 ss;
185 _STRUCT_X86_AVX512_STATE64 fs;
186 };
187
188 #define _STRUCT_MCONTEXT_AVX512_64_FULL struct mcontext_avx512_64_full
189 _STRUCT_MCONTEXT_AVX512_64_FULL
190 {
191 _STRUCT_X86_EXCEPTION_STATE64 es;
192 _STRUCT_X86_THREAD_FULL_STATE64 ss;
193 _STRUCT_X86_AVX512_STATE64 fs;
194 };
195 #endif /* _STRUCT_X86_AVX512_STATE64 */
196
197 #endif /* __DARWIN_UNIX03 */
198 #endif /* _STRUCT_MCONTEXT64 */
199
200
201 #ifndef _MCONTEXT_T
202 #define _MCONTEXT_T
203 #if defined(__LP64__)
204 typedef _STRUCT_MCONTEXT64 *mcontext_t;
205 #define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
206 #else
207 typedef _STRUCT_MCONTEXT32 *mcontext_t;
208 #define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32
209 #endif
210 #endif /* _MCONTEXT_T */
211
212 #endif /* __I386_MCONTEXT_H_ */