xref: /xnu-8796.141.3/bsd/i386/_mcontext.h (revision 1b191cb58250d0705d8a51287127505aa4bc0789)
1*1b191cb5SApple OSS Distributions /*
2*1b191cb5SApple OSS Distributions  * Copyright (c) 2003-2012 Apple Inc. All rights reserved.
3*1b191cb5SApple OSS Distributions  *
4*1b191cb5SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*1b191cb5SApple OSS Distributions  *
6*1b191cb5SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*1b191cb5SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*1b191cb5SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*1b191cb5SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*1b191cb5SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*1b191cb5SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*1b191cb5SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*1b191cb5SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*1b191cb5SApple OSS Distributions  *
15*1b191cb5SApple OSS Distributions  * Please obtain a copy of the License at
16*1b191cb5SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*1b191cb5SApple OSS Distributions  *
18*1b191cb5SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*1b191cb5SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*1b191cb5SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*1b191cb5SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*1b191cb5SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*1b191cb5SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*1b191cb5SApple OSS Distributions  * limitations under the License.
25*1b191cb5SApple OSS Distributions  *
26*1b191cb5SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*1b191cb5SApple OSS Distributions  */
28*1b191cb5SApple OSS Distributions 
29*1b191cb5SApple OSS Distributions #ifndef __I386_MCONTEXT_H_
30*1b191cb5SApple OSS Distributions #define __I386_MCONTEXT_H_
31*1b191cb5SApple OSS Distributions 
32*1b191cb5SApple OSS Distributions #if defined (__i386__) || defined (__x86_64__)
33*1b191cb5SApple OSS Distributions 
34*1b191cb5SApple OSS Distributions #include <sys/cdefs.h> /* __DARWIN_UNIX03 */
35*1b191cb5SApple OSS Distributions #include <sys/appleapiopts.h>
36*1b191cb5SApple OSS Distributions #include <mach/machine/_structs.h>
37*1b191cb5SApple OSS Distributions 
38*1b191cb5SApple OSS Distributions #ifndef _STRUCT_MCONTEXT32
39*1b191cb5SApple OSS Distributions #if __DARWIN_UNIX03
40*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT32      struct __darwin_mcontext32
41*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT32
42*1b191cb5SApple OSS Distributions {
43*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE32   __es;
44*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE32      __ss;
45*1b191cb5SApple OSS Distributions 	_STRUCT_X86_FLOAT_STATE32       __fs;
46*1b191cb5SApple OSS Distributions };
47*1b191cb5SApple OSS Distributions 
48*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX32  struct __darwin_mcontext_avx32
49*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX32
50*1b191cb5SApple OSS Distributions {
51*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE32   __es;
52*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE32      __ss;
53*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX_STATE32         __fs;
54*1b191cb5SApple OSS Distributions };
55*1b191cb5SApple OSS Distributions 
56*1b191cb5SApple OSS Distributions #if defined(_STRUCT_X86_AVX512_STATE32)
57*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX512_32      struct __darwin_mcontext_avx512_32
58*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX512_32
59*1b191cb5SApple OSS Distributions {
60*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE32   __es;
61*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE32      __ss;
62*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX512_STATE32      __fs;
63*1b191cb5SApple OSS Distributions };
64*1b191cb5SApple OSS Distributions #endif /* _STRUCT_X86_AVX512_STATE32 */
65*1b191cb5SApple OSS Distributions 
66*1b191cb5SApple OSS Distributions #else /* !__DARWIN_UNIX03 */
67*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT32      struct mcontext32
68*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT32
69*1b191cb5SApple OSS Distributions {
70*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE32   es;
71*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE32      ss;
72*1b191cb5SApple OSS Distributions 	_STRUCT_X86_FLOAT_STATE32       fs;
73*1b191cb5SApple OSS Distributions };
74*1b191cb5SApple OSS Distributions 
75*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX32  struct mcontext_avx32
76*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX32
77*1b191cb5SApple OSS Distributions {
78*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE32   es;
79*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE32      ss;
80*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX_STATE32         fs;
81*1b191cb5SApple OSS Distributions };
82*1b191cb5SApple OSS Distributions 
83*1b191cb5SApple OSS Distributions #if defined(_STRUCT_X86_AVX512_STATE32)
84*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX512_32      struct mcontext_avx512_32
85*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX512_32
86*1b191cb5SApple OSS Distributions {
87*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE32   es;
88*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE32      ss;
89*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX512_STATE32      fs;
90*1b191cb5SApple OSS Distributions };
91*1b191cb5SApple OSS Distributions #endif /* _STRUCT_X86_AVX512_STATE32 */
92*1b191cb5SApple OSS Distributions 
93*1b191cb5SApple OSS Distributions #endif /* __DARWIN_UNIX03 */
94*1b191cb5SApple OSS Distributions #endif /* _STRUCT_MCONTEXT32 */
95*1b191cb5SApple OSS Distributions 
96*1b191cb5SApple OSS Distributions #ifndef _STRUCT_MCONTEXT64
97*1b191cb5SApple OSS Distributions #if __DARWIN_UNIX03
98*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT64      struct __darwin_mcontext64
99*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT64
100*1b191cb5SApple OSS Distributions {
101*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   __es;
102*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE64      __ss;
103*1b191cb5SApple OSS Distributions 	_STRUCT_X86_FLOAT_STATE64       __fs;
104*1b191cb5SApple OSS Distributions };
105*1b191cb5SApple OSS Distributions 
106*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT64_FULL      struct __darwin_mcontext64_full
107*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT64_FULL
108*1b191cb5SApple OSS Distributions {
109*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   __es;
110*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_FULL_STATE64 __ss;
111*1b191cb5SApple OSS Distributions 	_STRUCT_X86_FLOAT_STATE64       __fs;
112*1b191cb5SApple OSS Distributions };
113*1b191cb5SApple OSS Distributions 
114*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX64  struct __darwin_mcontext_avx64
115*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX64
116*1b191cb5SApple OSS Distributions {
117*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   __es;
118*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE64      __ss;
119*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX_STATE64         __fs;
120*1b191cb5SApple OSS Distributions };
121*1b191cb5SApple OSS Distributions 
122*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX64_FULL  struct __darwin_mcontext_avx64_full
123*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX64_FULL
124*1b191cb5SApple OSS Distributions {
125*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   __es;
126*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_FULL_STATE64 __ss;
127*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX_STATE64         __fs;
128*1b191cb5SApple OSS Distributions };
129*1b191cb5SApple OSS Distributions 
130*1b191cb5SApple OSS Distributions #if defined(_STRUCT_X86_AVX512_STATE64)
131*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX512_64      struct __darwin_mcontext_avx512_64
132*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX512_64
133*1b191cb5SApple OSS Distributions {
134*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   __es;
135*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE64      __ss;
136*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX512_STATE64      __fs;
137*1b191cb5SApple OSS Distributions };
138*1b191cb5SApple OSS Distributions 
139*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX512_64_FULL      struct __darwin_mcontext_avx512_64_full
140*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX512_64_FULL
141*1b191cb5SApple OSS Distributions {
142*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   __es;
143*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_FULL_STATE64 __ss;
144*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX512_STATE64      __fs;
145*1b191cb5SApple OSS Distributions };
146*1b191cb5SApple OSS Distributions #endif /* _STRUCT_X86_AVX512_STATE64 */
147*1b191cb5SApple OSS Distributions 
148*1b191cb5SApple OSS Distributions #else /* !__DARWIN_UNIX03 */
149*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT64      struct mcontext64
150*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT64
151*1b191cb5SApple OSS Distributions {
152*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   es;
153*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE64      ss;
154*1b191cb5SApple OSS Distributions 	_STRUCT_X86_FLOAT_STATE64       fs;
155*1b191cb5SApple OSS Distributions };
156*1b191cb5SApple OSS Distributions 
157*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT64_FULL      struct mcontext64_full
158*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT64_FULL
159*1b191cb5SApple OSS Distributions {
160*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   es;
161*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_FULL_STATE64 ss;
162*1b191cb5SApple OSS Distributions 	_STRUCT_X86_FLOAT_STATE64       fs;
163*1b191cb5SApple OSS Distributions };
164*1b191cb5SApple OSS Distributions 
165*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX64  struct mcontext_avx64
166*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX64
167*1b191cb5SApple OSS Distributions {
168*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   es;
169*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE64      ss;
170*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX_STATE64         fs;
171*1b191cb5SApple OSS Distributions };
172*1b191cb5SApple OSS Distributions 
173*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX64_FULL  struct mcontext_avx64_full
174*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX64_FULL
175*1b191cb5SApple OSS Distributions {
176*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   es;
177*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_FULL_STATE64 ss;
178*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX_STATE64         fs;
179*1b191cb5SApple OSS Distributions };
180*1b191cb5SApple OSS Distributions 
181*1b191cb5SApple OSS Distributions #if defined(_STRUCT_X86_AVX512_STATE64)
182*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX512_64      struct mcontext_avx512_64
183*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX512_64
184*1b191cb5SApple OSS Distributions {
185*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   es;
186*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_STATE64      ss;
187*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX512_STATE64      fs;
188*1b191cb5SApple OSS Distributions };
189*1b191cb5SApple OSS Distributions 
190*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT_AVX512_64_FULL      struct mcontext_avx512_64_full
191*1b191cb5SApple OSS Distributions _STRUCT_MCONTEXT_AVX512_64_FULL
192*1b191cb5SApple OSS Distributions {
193*1b191cb5SApple OSS Distributions 	_STRUCT_X86_EXCEPTION_STATE64   es;
194*1b191cb5SApple OSS Distributions 	_STRUCT_X86_THREAD_FULL_STATE64 ss;
195*1b191cb5SApple OSS Distributions 	_STRUCT_X86_AVX512_STATE64      fs;
196*1b191cb5SApple OSS Distributions };
197*1b191cb5SApple OSS Distributions #endif /* _STRUCT_X86_AVX512_STATE64 */
198*1b191cb5SApple OSS Distributions 
199*1b191cb5SApple OSS Distributions #endif /* __DARWIN_UNIX03 */
200*1b191cb5SApple OSS Distributions #endif /* _STRUCT_MCONTEXT64 */
201*1b191cb5SApple OSS Distributions 
202*1b191cb5SApple OSS Distributions 
203*1b191cb5SApple OSS Distributions #ifndef _MCONTEXT_T
204*1b191cb5SApple OSS Distributions #define _MCONTEXT_T
205*1b191cb5SApple OSS Distributions #if defined(__LP64__)
206*1b191cb5SApple OSS Distributions typedef _STRUCT_MCONTEXT64      *mcontext_t;
207*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
208*1b191cb5SApple OSS Distributions #else
209*1b191cb5SApple OSS Distributions typedef _STRUCT_MCONTEXT32      *mcontext_t;
210*1b191cb5SApple OSS Distributions #define _STRUCT_MCONTEXT        _STRUCT_MCONTEXT32
211*1b191cb5SApple OSS Distributions #endif
212*1b191cb5SApple OSS Distributions #endif /* _MCONTEXT_T */
213*1b191cb5SApple OSS Distributions 
214*1b191cb5SApple OSS Distributions #endif /* defined (__i386__) || defined (__x86_64__) */
215*1b191cb5SApple OSS Distributions 
216*1b191cb5SApple OSS Distributions #endif /* __I386_MCONTEXT_H_ */
217