]> git.saurik.com Git - apple/libplatform.git/blame - src/ucontext/arm64/mcontext.c
libplatform-254.40.4.tar.gz
[apple/libplatform.git] / src / ucontext / arm64 / mcontext.c
CommitLineData
442fbc9d
A
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