compiler.h 850 B

1234567891011121314151617181920212223242526
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_COMPILER_H
  3. #define __ASM_COMPILER_H
  4. #ifdef ARM64_ASM_ARCH
  5. #define ARM64_ASM_PREAMBLE ".arch " ARM64_ASM_ARCH "\n"
  6. #else
  7. #define ARM64_ASM_PREAMBLE
  8. #endif
  9. /*
  10. * The EL0/EL1 pointer bits used by a pointer authentication code.
  11. * This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply.
  12. */
  13. #define ptrauth_user_pac_mask() GENMASK_ULL(54, vabits_actual)
  14. #define ptrauth_kernel_pac_mask() GENMASK_ULL(63, vabits_actual)
  15. /* Valid for EL0 TTBR0 and EL1 TTBR1 instruction pointers */
  16. #define ptrauth_clear_pac(ptr) \
  17. ((ptr & BIT_ULL(55)) ? (ptr | ptrauth_kernel_pac_mask()) : \
  18. (ptr & ~ptrauth_user_pac_mask()))
  19. #define __builtin_return_address(val) \
  20. (void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val)))
  21. #endif /* __ASM_COMPILER_H */