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