2 * Copyright (c) 2004-2007 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
31 #ifndef _MACH_ARM__STRUCTS_H_
32 #define _MACH_ARM__STRUCTS_H_
34 #include <sys/cdefs.h> /* __DARWIN_UNIX03 */
35 #include <machine/types.h> /* __uint32_t */
38 #define _STRUCT_ARM_EXCEPTION_STATE struct __darwin_arm_exception_state
39 _STRUCT_ARM_EXCEPTION_STATE
41 __uint32_t __exception
; /* number of arm exception taken */
42 __uint32_t __fsr
; /* Fault status */
43 __uint32_t __far
; /* Virtual Fault Address */
45 #else /* !__DARWIN_UNIX03 */
46 #define _STRUCT_ARM_EXCEPTION_STATE struct arm_exception_state
47 _STRUCT_ARM_EXCEPTION_STATE
49 __uint32_t exception
; /* number of arm exception taken */
50 __uint32_t fsr
; /* Fault status */
51 __uint32_t far
; /* Virtual Fault Address */
53 #endif /* __DARWIN_UNIX03 */
56 #define _STRUCT_ARM_EXCEPTION_STATE64 struct __darwin_arm_exception_state64
57 _STRUCT_ARM_EXCEPTION_STATE64
59 __uint64_t __far
; /* Virtual Fault Address */
60 __uint32_t __esr
; /* Exception syndrome */
61 __uint32_t __exception
; /* number of arm exception taken */
63 #else /* !__DARWIN_UNIX03 */
64 #define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64
65 _STRUCT_ARM_EXCEPTION_STATE64
67 __uint64_t far
; /* Virtual Fault Address */
68 __uint32_t esr
; /* Exception syndrome */
69 __uint32_t exception
; /* number of arm exception taken */
71 #endif /* __DARWIN_UNIX03 */
74 #define _STRUCT_ARM_THREAD_STATE struct __darwin_arm_thread_state
75 _STRUCT_ARM_THREAD_STATE
77 __uint32_t __r
[13]; /* General purpose register r0-r12 */
78 __uint32_t __sp
; /* Stack pointer r13 */
79 __uint32_t __lr
; /* Link register r14 */
80 __uint32_t __pc
; /* Program counter r15 */
81 __uint32_t __cpsr
; /* Current program status register */
83 #else /* !__DARWIN_UNIX03 */
84 #define _STRUCT_ARM_THREAD_STATE struct arm_thread_state
85 _STRUCT_ARM_THREAD_STATE
87 __uint32_t r
[13]; /* General purpose register r0-r12 */
88 __uint32_t sp
; /* Stack pointer r13 */
89 __uint32_t lr
; /* Link register r14 */
90 __uint32_t pc
; /* Program counter r15 */
91 __uint32_t cpsr
; /* Current program status register */
93 #endif /* __DARWIN_UNIX03 */
97 #define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
98 #define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
99 #define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
101 #define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
102 _STRUCT_ARM_THREAD_STATE64
104 __uint64_t x
[29]; /* General purpose registers x0-x28 */
105 __uint64_t fp
; /* Frame pointer x29 */
106 __uint64_t lr
; /* Link register x30 */
107 __uint64_t sp
; /* Stack pointer x31 */
108 __uint64_t pc
; /* Program counter */
109 __uint32_t cpsr
; /* Current program status register */
110 __uint32_t flags
; /* Flags describing structure format */
113 #else /* defined(KERNEL) */
116 * By default, the pointer fields in the arm_thread_state64_t structure are
117 * opaque on the arm64e architecture and require the use of accessor macros.
118 * This mode can also be enabled on the arm64 architecture by building with
119 * -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1.
121 #if defined(__arm64__) && defined(__LP64__)
123 #if __has_feature(ptrauth_calls)
124 #define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1
125 #define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1
126 #endif /* __has_feature(ptrauth_calls) */
128 #ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64
129 #define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
132 #else /* defined(__arm64__) && defined(__LP64__) */
134 #undef __DARWIN_OPAQUE_ARM_THREAD_STATE64
135 #define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
137 #endif /* defined(__arm64__) && defined(__LP64__) */
140 #define _STRUCT_ARM_THREAD_STATE64 struct __darwin_arm_thread_state64
141 #if __DARWIN_OPAQUE_ARM_THREAD_STATE64
142 _STRUCT_ARM_THREAD_STATE64
144 __uint64_t __x
[29]; /* General purpose registers x0-x28 */
145 void* __opaque_fp
; /* Frame pointer x29 */
146 void* __opaque_lr
; /* Link register x30 */
147 void* __opaque_sp
; /* Stack pointer x31 */
148 void* __opaque_pc
; /* Program counter */
149 __uint32_t __cpsr
; /* Current program status register */
150 __uint32_t __opaque_flags
; /* Flags describing structure format */
152 #else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
153 _STRUCT_ARM_THREAD_STATE64
155 __uint64_t __x
[29]; /* General purpose registers x0-x28 */
156 __uint64_t __fp
; /* Frame pointer x29 */
157 __uint64_t __lr
; /* Link register x30 */
158 __uint64_t __sp
; /* Stack pointer x31 */
159 __uint64_t __pc
; /* Program counter */
160 __uint32_t __cpsr
; /* Current program status register */
161 __uint32_t __pad
; /* Same size for 32-bit or 64-bit clients */
163 #endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
164 #else /* !__DARWIN_UNIX03 */
165 #define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
166 #if __DARWIN_OPAQUE_ARM_THREAD_STATE64
167 _STRUCT_ARM_THREAD_STATE64
169 __uint64_t x
[29]; /* General purpose registers x0-x28 */
170 void* __opaque_fp
; /* Frame pointer x29 */
171 void* __opaque_lr
; /* Link register x30 */
172 void* __opaque_sp
; /* Stack pointer x31 */
173 void* __opaque_pc
; /* Program counter */
174 __uint32_t cpsr
; /* Current program status register */
175 __uint32_t __opaque_flags
; /* Flags describing structure format */
177 #else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
178 _STRUCT_ARM_THREAD_STATE64
180 __uint64_t x
[29]; /* General purpose registers x0-x28 */
181 __uint64_t fp
; /* Frame pointer x29 */
182 __uint64_t lr
; /* Link register x30 */
183 __uint64_t sp
; /* Stack pointer x31 */
184 __uint64_t pc
; /* Program counter */
185 __uint32_t cpsr
; /* Current program status register */
186 __uint32_t __pad
; /* Same size for 32-bit or 64-bit clients */
188 #endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
189 #endif /* __DARWIN_UNIX03 */
191 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
193 /* Accessor macros for arm_thread_state64_t pointer fields */
195 #if __has_feature(ptrauth_calls) && defined(__LP64__)
198 #if !__DARWIN_OPAQUE_ARM_THREAD_STATE64 || !__DARWIN_PTRAUTH_ARM_THREAD_STATE64
199 #error "Invalid configuration"
202 #define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
203 #define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
205 /* Return pc field of arm_thread_state64_t as a data pointer value */
206 #define __darwin_arm_thread_state64_get_pc(ts) \
207 __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
208 (uintptr_t)(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
209 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
210 ptrauth_auth_data(__tsp->__opaque_pc, \
211 ptrauth_key_process_independent_code, \
212 ptrauth_string_discriminator("pc")) : __tsp->__opaque_pc); })
213 /* Return pc field of arm_thread_state64_t as a function pointer. May return
214 * NULL if a valid function pointer cannot be constructed, the caller should
215 * fall back to the __darwin_arm_thread_state64_get_pc() macro in that case. */
216 #define __darwin_arm_thread_state64_get_pc_fptr(ts) \
217 __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
218 (__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
219 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
220 ptrauth_auth_function(__tsp->__opaque_pc, \
221 ptrauth_key_process_independent_code, \
222 ptrauth_string_discriminator("pc")) : NULL); })
223 /* Set pc field of arm_thread_state64_t to a function pointer */
224 #define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
225 __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
226 __typeof__(fptr) __f = (fptr); __tsp->__opaque_pc = \
227 (__f ? (!(__tsp->__opaque_flags & \
228 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
229 ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
230 ptrauth_key_process_independent_code, \
231 ptrauth_string_discriminator("pc")) : ptrauth_auth_data(__f, \
232 ptrauth_key_function_pointer, 0)) : __f); })
233 /* Return lr field of arm_thread_state64_t as a data pointer value */
234 #define __darwin_arm_thread_state64_get_lr(ts) \
235 __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
236 (uintptr_t)(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
237 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
238 __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
239 ptrauth_auth_data(__tsp->__opaque_lr, \
240 ptrauth_key_process_independent_code, \
241 ptrauth_string_discriminator("lr")) : __tsp->__opaque_lr); })
242 /* Return lr field of arm_thread_state64_t as a function pointer. May return
243 * NULL if a valid function pointer cannot be constructed, the caller should
244 * fall back to the __darwin_arm_thread_state64_get_lr() macro in that case. */
245 #define __darwin_arm_thread_state64_get_lr_fptr(ts) \
246 __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
247 (__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
248 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
249 __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
250 ptrauth_auth_function(__tsp->__opaque_lr, \
251 ptrauth_key_process_independent_code, \
252 ptrauth_string_discriminator("lr")) : NULL); })
253 /* Set lr field of arm_thread_state64_t to a function pointer */
254 #define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
255 __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
256 __typeof__(fptr) __f = (fptr); __tsp->__opaque_lr = \
257 (__f ? (!(__tsp->__opaque_flags & \
258 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? (__tsp->__opaque_flags \
259 &= ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR , \
260 ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
261 ptrauth_key_process_independent_code, \
262 ptrauth_string_discriminator("lr"))) : ptrauth_auth_data(__f, \
263 ptrauth_key_function_pointer, 0)) : __f); })
264 /* Return sp field of arm_thread_state64_t as a data pointer value */
265 #define __darwin_arm_thread_state64_get_sp(ts) \
266 __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
267 (uintptr_t)(__tsp->__opaque_sp && !(__tsp->__opaque_flags & \
268 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
269 ptrauth_auth_data(__tsp->__opaque_sp, \
270 ptrauth_key_process_independent_data, \
271 ptrauth_string_discriminator("sp")) : __tsp->__opaque_sp); })
272 /* Set sp field of arm_thread_state64_t to a data pointer value */
273 #define __darwin_arm_thread_state64_set_sp(ts, ptr) \
274 __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
275 void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_sp = \
276 (__p && !(__tsp->__opaque_flags & \
277 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
278 ptrauth_sign_unauthenticated(__p, \
279 ptrauth_key_process_independent_data, \
280 ptrauth_string_discriminator("sp")) : __p); })
281 /* Return fp field of arm_thread_state64_t as a data pointer value */
282 #define __darwin_arm_thread_state64_get_fp(ts) \
283 __extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
284 (uintptr_t)(__tsp->__opaque_fp && !(__tsp->__opaque_flags & \
285 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
286 ptrauth_auth_data(__tsp->__opaque_fp, \
287 ptrauth_key_process_independent_data, \
288 ptrauth_string_discriminator("fp")) : __tsp->__opaque_fp); })
289 /* Set fp field of arm_thread_state64_t to a data pointer value */
290 #define __darwin_arm_thread_state64_set_fp(ts, ptr) \
291 __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
292 void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_fp = \
293 (__p && !(__tsp->__opaque_flags & \
294 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
295 ptrauth_sign_unauthenticated(__p, \
296 ptrauth_key_process_independent_data, \
297 ptrauth_string_discriminator("fp")) : __p); })
299 /* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
300 #define __darwin_arm_thread_state64_ptrauth_strip(ts) \
301 __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
302 __tsp->__opaque_pc = ((__tsp->__opaque_flags & \
303 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_pc : \
304 ptrauth_strip(__tsp->__opaque_pc, ptrauth_key_process_independent_code)); \
305 __tsp->__opaque_lr = ((__tsp->__opaque_flags & \
306 (__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
307 __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? __tsp->__opaque_lr : \
308 ptrauth_strip(__tsp->__opaque_lr, ptrauth_key_process_independent_code)); \
309 __tsp->__opaque_sp = ((__tsp->__opaque_flags & \
310 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_sp : \
311 ptrauth_strip(__tsp->__opaque_sp, ptrauth_key_process_independent_data)); \
312 __tsp->__opaque_fp = ((__tsp->__opaque_flags & \
313 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_fp : \
314 ptrauth_strip(__tsp->__opaque_fp, ptrauth_key_process_independent_data)); \
315 __tsp->__opaque_flags |= \
316 __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH; })
318 #else /* __has_feature(ptrauth_calls) && defined(__LP64__) */
320 #if __DARWIN_OPAQUE_ARM_THREAD_STATE64
323 #error "Invalid configuration"
326 /* Return pc field of arm_thread_state64_t as a data pointer value */
327 #define __darwin_arm_thread_state64_get_pc(ts) \
328 ((uintptr_t)((ts).__opaque_pc))
329 /* Return pc field of arm_thread_state64_t as a function pointer */
330 #define __darwin_arm_thread_state64_get_pc_fptr(ts) \
332 /* Set pc field of arm_thread_state64_t to a function pointer */
333 #define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
334 ((ts).__opaque_pc = (fptr))
335 /* Return lr field of arm_thread_state64_t as a data pointer value */
336 #define __darwin_arm_thread_state64_get_lr(ts) \
337 ((uintptr_t)((ts).__opaque_lr))
338 /* Return lr field of arm_thread_state64_t as a function pointer */
339 #define __darwin_arm_thread_state64_get_lr_fptr(ts) \
341 /* Set lr field of arm_thread_state64_t to a function pointer */
342 #define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
343 ((ts).__opaque_lr = (fptr))
344 /* Return sp field of arm_thread_state64_t as a data pointer value */
345 #define __darwin_arm_thread_state64_get_sp(ts) \
346 ((uintptr_t)((ts).__opaque_sp))
347 /* Set sp field of arm_thread_state64_t to a data pointer value */
348 #define __darwin_arm_thread_state64_set_sp(ts, ptr) \
349 ((ts).__opaque_sp = (void*)(uintptr_t)(ptr))
350 /* Return fp field of arm_thread_state64_t as a data pointer value */
351 #define __darwin_arm_thread_state64_get_fp(ts) \
352 ((uintptr_t)((ts).__opaque_fp))
353 /* Set fp field of arm_thread_state64_t to a data pointer value */
354 #define __darwin_arm_thread_state64_set_fp(ts, ptr) \
355 ((ts).__opaque_fp = (void*)(uintptr_t)(ptr))
356 /* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
357 #define __darwin_arm_thread_state64_ptrauth_strip(ts) \
360 #else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
363 /* Return pc field of arm_thread_state64_t as a data pointer value */
364 #define __darwin_arm_thread_state64_get_pc(ts) \
366 /* Return pc field of arm_thread_state64_t as a function pointer */
367 #define __darwin_arm_thread_state64_get_pc_fptr(ts) \
368 ((void*)(uintptr_t)((ts).__pc))
369 /* Set pc field of arm_thread_state64_t to a function pointer */
370 #define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
371 ((ts).__pc = (uintptr_t)(fptr))
372 /* Return lr field of arm_thread_state64_t as a data pointer value */
373 #define __darwin_arm_thread_state64_get_lr(ts) \
375 /* Return lr field of arm_thread_state64_t as a function pointer */
376 #define __darwin_arm_thread_state64_get_lr_fptr(ts) \
377 ((void*)(uintptr_t)((ts).__lr))
378 /* Set lr field of arm_thread_state64_t to a function pointer */
379 #define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
380 ((ts).__lr = (uintptr_t)(fptr))
381 /* Return sp field of arm_thread_state64_t as a data pointer value */
382 #define __darwin_arm_thread_state64_get_sp(ts) \
384 /* Set sp field of arm_thread_state64_t to a data pointer value */
385 #define __darwin_arm_thread_state64_set_sp(ts, ptr) \
386 ((ts).__sp = (uintptr_t)(ptr))
387 /* Return fp field of arm_thread_state64_t as a data pointer value */
388 #define __darwin_arm_thread_state64_get_fp(ts) \
390 /* Set fp field of arm_thread_state64_t to a data pointer value */
391 #define __darwin_arm_thread_state64_set_fp(ts, ptr) \
392 ((ts).__fp = (uintptr_t)(ptr))
393 /* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
394 #define __darwin_arm_thread_state64_ptrauth_strip(ts) \
397 #else /* __DARWIN_UNIX03 */
399 /* Return pc field of arm_thread_state64_t as a data pointer value */
400 #define __darwin_arm_thread_state64_get_pc(ts) \
402 /* Return pc field of arm_thread_state64_t as a function pointer */
403 #define __darwin_arm_thread_state64_get_pc_fptr(ts) \
404 ((void*)(uintptr_t)((ts).pc))
405 /* Set pc field of arm_thread_state64_t to a function pointer */
406 #define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
407 ((ts).pc = (uintptr_t)(fptr))
408 /* Return lr field of arm_thread_state64_t as a data pointer value */
409 #define __darwin_arm_thread_state64_get_lr(ts) \
411 /* Return lr field of arm_thread_state64_t as a function pointer */
412 #define __darwin_arm_thread_state64_get_lr_fptr(ts) \
413 ((void*)(uintptr_t)((ts).lr))
414 /* Set lr field of arm_thread_state64_t to a function pointer */
415 #define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
416 ((ts).lr = (uintptr_t)(fptr))
417 /* Return sp field of arm_thread_state64_t as a data pointer value */
418 #define __darwin_arm_thread_state64_get_sp(ts) \
420 /* Set sp field of arm_thread_state64_t to a data pointer value */
421 #define __darwin_arm_thread_state64_set_sp(ts, ptr) \
422 ((ts).sp = (uintptr_t)(ptr))
423 /* Return fp field of arm_thread_state64_t as a data pointer value */
424 #define __darwin_arm_thread_state64_get_fp(ts) \
426 /* Set fp field of arm_thread_state64_t to a data pointer value */
427 #define __darwin_arm_thread_state64_set_fp(ts, ptr) \
428 ((ts).fp = (uintptr_t)(ptr))
429 /* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
430 #define __darwin_arm_thread_state64_ptrauth_strip(ts) \
433 #endif /* __DARWIN_UNIX03 */
434 #endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
436 #endif /* __has_feature(ptrauth_calls) && defined(__LP64__) */
437 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
438 #endif /* !defined(KERNEL) */
441 #define _STRUCT_ARM_VFP_STATE struct __darwin_arm_vfp_state
442 _STRUCT_ARM_VFP_STATE
447 #else /* !__DARWIN_UNIX03 */
448 #define _STRUCT_ARM_VFP_STATE struct arm_vfp_state
449 _STRUCT_ARM_VFP_STATE
454 #endif /* __DARWIN_UNIX03 */
457 #define _STRUCT_ARM_NEON_STATE64 struct __darwin_arm_neon_state64
458 #define _STRUCT_ARM_NEON_STATE struct __darwin_arm_neon_state
460 #if defined(__arm64__)
461 _STRUCT_ARM_NEON_STATE64
468 _STRUCT_ARM_NEON_STATE
474 #elif defined(__arm__)
476 * No 128-bit intrinsic for ARM; leave it opaque for now.
478 _STRUCT_ARM_NEON_STATE64
480 char opaque
[(32 * 16) + (2 * sizeof(__uint32_t
))];
481 } __attribute__((aligned(16)));
483 _STRUCT_ARM_NEON_STATE
485 char opaque
[(16 * 16) + (2 * sizeof(__uint32_t
))];
486 } __attribute__((aligned(16)));
489 #error Unknown architecture.
492 #else /* !__DARWIN_UNIX03 */
493 #define _STRUCT_ARM_NEON_STATE64 struct arm_neon_state64
494 #define _STRUCT_ARM_NEON_STATE struct arm_neon_state
496 #if defined(__arm64__)
497 _STRUCT_ARM_NEON_STATE64
504 _STRUCT_ARM_NEON_STATE
510 #elif defined(__arm__)
512 * No 128-bit intrinsic for ARM; leave it opaque for now.
514 _STRUCT_ARM_NEON_STATE64
516 char opaque
[(32 * 16) + (2 * sizeof(__uint32_t
))];
517 } __attribute__((aligned(16)));
519 _STRUCT_ARM_NEON_STATE
521 char opaque
[(16 * 16) + (2 * sizeof(__uint32_t
))];
522 } __attribute__((aligned(16)));
525 #error Unknown architecture.
528 #endif /* __DARWIN_UNIX03 */
531 #define _STRUCT_ARM_PAGEIN_STATE struct __arm_pagein_state
532 _STRUCT_ARM_PAGEIN_STATE
541 /* Old-fashioned debug state is only for ARM */
544 #define _STRUCT_ARM_DEBUG_STATE struct __darwin_arm_debug_state
545 _STRUCT_ARM_DEBUG_STATE
547 __uint32_t __bvr
[16];
548 __uint32_t __bcr
[16];
549 __uint32_t __wvr
[16];
550 __uint32_t __wcr
[16];
552 #else /* !__DARWIN_UNIX03 */
553 #define _STRUCT_ARM_DEBUG_STATE struct arm_debug_state
554 _STRUCT_ARM_DEBUG_STATE
561 #endif /* __DARWIN_UNIX03 */
563 #elif defined(__arm64__)
565 /* ARM's arm_debug_state is ARM64's arm_legacy_debug_state */
568 #define _STRUCT_ARM_LEGACY_DEBUG_STATE struct __arm_legacy_debug_state
569 _STRUCT_ARM_LEGACY_DEBUG_STATE
571 __uint32_t __bvr
[16];
572 __uint32_t __bcr
[16];
573 __uint32_t __wvr
[16];
574 __uint32_t __wcr
[16];
576 #else /* __DARWIN_UNIX03 */
577 #define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state
578 _STRUCT_ARM_LEGACY_DEBUG_STATE
585 #endif /* __DARWIN_UNIX03 */
587 #error unknown architecture
591 #define _STRUCT_ARM_DEBUG_STATE32 struct __darwin_arm_debug_state32
592 _STRUCT_ARM_DEBUG_STATE32
594 __uint32_t __bvr
[16];
595 __uint32_t __bcr
[16];
596 __uint32_t __wvr
[16];
597 __uint32_t __wcr
[16];
598 __uint64_t __mdscr_el1
; /* Bit 0 is SS (Hardware Single Step) */
601 #define _STRUCT_ARM_DEBUG_STATE64 struct __darwin_arm_debug_state64
602 _STRUCT_ARM_DEBUG_STATE64
604 __uint64_t __bvr
[16];
605 __uint64_t __bcr
[16];
606 __uint64_t __wvr
[16];
607 __uint64_t __wcr
[16];
608 __uint64_t __mdscr_el1
; /* Bit 0 is SS (Hardware Single Step) */
610 #else /* !__DARWIN_UNIX03 */
611 #define _STRUCT_ARM_DEBUG_STATE32 struct arm_debug_state32
612 _STRUCT_ARM_DEBUG_STATE32
618 __uint64_t mdscr_el1
; /* Bit 0 is SS (Hardware Single Step) */
621 #define _STRUCT_ARM_DEBUG_STATE64 struct arm_debug_state64
622 _STRUCT_ARM_DEBUG_STATE64
628 __uint64_t mdscr_el1
; /* Bit 0 is SS (Hardware Single Step) */
630 #endif /* __DARWIN_UNIX03 */
633 #define _STRUCT_ARM_CPMU_STATE64 struct __darwin_arm_cpmu_state64
634 _STRUCT_ARM_CPMU_STATE64
636 __uint64_t __ctrs
[16];
638 #else /* __DARWIN_UNIX03 */
639 #define _STRUCT_ARM_CPMU_STATE64 struct arm_cpmu_state64
640 _STRUCT_ARM_CPMU_STATE64
644 #endif /* !__DARWIN_UNIX03 */
646 #endif /* _MACH_ARM__STRUCTS_H_ */