]>
Commit | Line | Data |
---|---|---|
442fbc9d A |
1 | /* |
2 | * Copyright (c) 2020 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_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. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
12 | * | |
13 | * The Original Code and all software distributed under the License are | |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | ||
24 | /* ASM Macro helpers */ | |
25 | #if defined(__ASSEMBLER__) | |
26 | ||
27 | .macro ARM64_STACK_PROLOG | |
28 | #if __has_feature(ptrauth_returns) | |
29 | pacibsp | |
30 | #endif | |
31 | .endmacro | |
32 | ||
33 | .macro ARM64_STACK_EPILOG | |
34 | #if __has_feature(ptrauth_returns) | |
35 | retab | |
36 | #else | |
37 | ret | |
38 | #endif | |
39 | .endmacro | |
40 | ||
41 | #define PUSH_FRAME \ | |
42 | stp fp, lr, [sp, #-16]! %% \ | |
43 | mov fp, sp %% | |
44 | ||
45 | #define POP_FRAME \ | |
46 | mov sp, fp %% \ | |
47 | ldp fp, lr, [sp], #16 %% | |
48 | #endif /* ASSEMBLER */ | |
49 | ||
50 | /* Offsets of the various register states inside of the mcontext data */ | |
51 | #define MCONTEXT_OFFSET_X0 16 | |
52 | ||
53 | #define MCONTEXT_OFFSET_X19_X20 168 | |
54 | #define MCONTEXT_OFFSET_X21_X22 184 | |
55 | #define MCONTEXT_OFFSET_X23_X24 200 | |
56 | ||
57 | #define MCONTEXT_OFFSET_X25_X26 216 | |
58 | #define MCONTEXT_OFFSET_X27_X28 232 | |
59 | ||
60 | #define MCONTEXT_OFFSET_FP_LR 248 | |
61 | #define MCONTEXT_OFFSET_SP 264 | |
62 | #define MCONTEXT_OFFSET_FLAGS 284 | |
63 | ||
64 | #define MCONTEXT_OFFSET_D8 424 | |
65 | #define MCONTEXT_OFFSET_D9 440 | |
66 | #define MCONTEXT_OFFSET_D10 456 | |
67 | #define MCONTEXT_OFFSET_D11 472 | |
68 | #define MCONTEXT_OFFSET_D12 488 | |
69 | #define MCONTEXT_OFFSET_D13 504 | |
70 | #define MCONTEXT_OFFSET_D14 520 | |
71 | #define MCONTEXT_OFFSET_D15 536 | |
72 | ||
73 | #if __has_feature(ptrauth_calls) | |
74 | #define LR_SIGNED_WITH_IB 0x2 /* Copied from __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR */ | |
75 | #define LR_SIGNED_WITH_IB_BIT 0x1 | |
76 | #endif |