Merge tag 'pinctrl-v5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6-microblaze.git] / arch / arm64 / include / asm / compiler.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_COMPILER_H
3 #define __ASM_COMPILER_H
4
5 #ifdef ARM64_ASM_ARCH
6 #define ARM64_ASM_PREAMBLE ".arch " ARM64_ASM_ARCH "\n"
7 #else
8 #define ARM64_ASM_PREAMBLE
9 #endif
10
11 /*
12  * The EL0/EL1 pointer bits used by a pointer authentication code.
13  * This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply.
14  */
15 #define ptrauth_user_pac_mask()         GENMASK_ULL(54, vabits_actual)
16 #define ptrauth_kernel_pac_mask()       GENMASK_ULL(63, vabits_actual)
17
18 /* Valid for EL0 TTBR0 and EL1 TTBR1 instruction pointers */
19 #define ptrauth_clear_pac(ptr)                                          \
20         ((ptr & BIT_ULL(55)) ? (ptr | ptrauth_kernel_pac_mask()) :      \
21                                (ptr & ~ptrauth_user_pac_mask()))
22
23 #define __builtin_return_address(val)                                   \
24         (void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val)))
25
26 #endif /* __ASM_COMPILER_H */