2 * @APPLE_LICENSE_HEADER_START@
4 * Copyright (c) 2018 Apple Inc. All Rights Reserved.
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
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.
21 * @APPLE_LICENSE_HEADER_END@
23 /********************************************************************
25 * arm64-asm.h - asm tools for arm64/arm64_32 and ROP/JOP
27 ********************************************************************/
34 #define SUPPORT_TAGGED_POINTERS 1
37 #define PTRSHIFT 3 // 1<<PTRSHIFT == PTRSIZE
38 // "p" registers are pointer-sized
63 #define SUPPORT_TAGGED_POINTERS 0
66 #define PTRSHIFT 2 // 1<<PTRSHIFT == PTRSIZE
67 // "p" registers are pointer-sized
92 #if __has_feature(ptrauth_returns)
94 # define SignLR pacibsp
95 # define AuthenticateLR autibsp
99 # define AuthenticateLR
102 #if __has_feature(ptrauth_calls)
105 .macro TailCallFunctionPointer
106 // $0 = function pointer value
110 .macro TailCallCachedImp
111 // $0 = cached imp, $1 = address of cached imp
115 .macro TailCallMethodListImp
116 // $0 = method list imp, $1 = address of method list imp
120 .macro TailCallBlockInvoke
121 // $0 = invoke function, $1 = address of invoke function
125 .macro AuthAndResignAsIMP
126 // $0 = cached imp, $1 = address of cached imp
127 autib $
0, $
1 // authenticate cached imp
128 paciza $
0 // resign cached imp as IMP
135 .macro TailCallFunctionPointer
136 // $0 = function pointer value
140 .macro TailCallCachedImp
141 // $0 = cached imp, $1 = address of cached imp
145 .macro TailCallMethodListImp
146 // $0 = method list imp, $1 = address of method list imp
150 .macro TailCallBlockInvoke
151 // $0 = invoke function, $1 = address of invoke function
155 .macro AuthAndResignAsIMP
162 #define TailCallBlockInvoke TailCallMethodListImp