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