]> git.saurik.com Git - apple/libplatform.git/blob - src/ucontext/arm64/mcontext.c
libplatform-254.40.4.tar.gz
[apple/libplatform.git] / src / ucontext / arm64 / mcontext.c
1 #include "asm_help.h"
2
3 #define _XOPEN_SOURCE 600L
4 #include <ucontext.h>
5 #include <stddef.h>
6
7 #include <mach/arm/thread_status.h>
8
9 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__x[0]) == MCONTEXT_OFFSET_X0,
10 "MCONTEXT_OFFSET_X0");
11 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__x[19]) == MCONTEXT_OFFSET_X19_X20,
12 "MCONTEXT_OFFSET_X19_X20");
13 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__x[21]) == MCONTEXT_OFFSET_X21_X22,
14 "MCONTEXT_OFFSET_X21_X22");
15 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__x[23]) == MCONTEXT_OFFSET_X23_X24,
16 "MCONTEXT_OFFSET_X23_X24");
17 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__x[25]) == MCONTEXT_OFFSET_X25_X26,
18 "MCONTEXT_OFFSET_X25_X26");
19 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__x[27]) == MCONTEXT_OFFSET_X27_X28,
20 "MCONTEXT_OFFSET_X27_X28");
21
22 #if __has_feature(ptrauth_calls)
23 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__opaque_fp) == MCONTEXT_OFFSET_FP_LR,
24 "MCONTEXT_OFFSET_FP_LR");
25 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__opaque_sp) == MCONTEXT_OFFSET_SP,
26 "MCONTEXT_OFFSET_SP");
27 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__opaque_flags) == MCONTEXT_OFFSET_FLAGS,
28 "MCONTEXT_OFFSET_FLAGS");
29 #else
30 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__fp) == MCONTEXT_OFFSET_FP_LR,
31 "MCONTEXT_OFFSET_FP_LR");
32 _Static_assert(offsetof(struct __darwin_mcontext64, __ss.__sp) == MCONTEXT_OFFSET_SP,
33 "MCONTEXT_OFFSET_SP");
34 #endif
35
36
37 // Neon registers are 128 bits wide. d suffix refers to the last 64 bits of the
38 // 128 bit register. Hence the -8 offset.
39 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[8]) == (MCONTEXT_OFFSET_D8 - 8),
40 "MCONTEXT_OFFSET_D8");
41 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[9]) == (MCONTEXT_OFFSET_D9 - 8),
42 "MCONTEXT_OFFSET_D9");
43 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[10]) == (MCONTEXT_OFFSET_D10 - 8),
44 "MCONTEXT_OFFSET_D10");
45 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[11]) == (MCONTEXT_OFFSET_D11 - 8),
46 "MCONTEXT_OFFSET_D11");
47 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[12]) == (MCONTEXT_OFFSET_D12 - 8),
48 "MCONTEXT_OFFSET_D12");
49 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[13]) == (MCONTEXT_OFFSET_D13 - 8),
50 "MCONTEXT_OFFSET_D13");
51 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[14]) == (MCONTEXT_OFFSET_D14 - 8),
52 "MCONTEXT_OFFSET_D14");
53 _Static_assert(offsetof(struct __darwin_mcontext64, __ns.__v[15]) == (MCONTEXT_OFFSET_D15 - 8),
54 "MCONTEXT_OFFSET_D15");
55
56 #if __has_feature(ptrauth_calls)
57 _Static_assert((1 << LR_SIGNED_WITH_IB_BIT) == LR_SIGNED_WITH_IB, "LR_SIGNED_WITH_IB_BIT");
58 #endif