1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2023 Arm Ltd. 4 */ 5 6 #ifndef _ASM_ARM64_POR_H 7 #define _ASM_ARM64_POR_H 8 9 #define POR_BITS_PER_PKEY 4 10 #define POR_ELx_IDX(por_elx, idx) (((por_elx) >> ((idx) * POR_BITS_PER_PKEY)) & 0xf) 11 12 static inline bool por_elx_allows_read(u64 por, u8 pkey) 13 { 14 u8 perm = POR_ELx_IDX(por, pkey); 15 16 return perm & POE_R; 17 } 18 19 static inline bool por_elx_allows_write(u64 por, u8 pkey) 20 { 21 u8 perm = POR_ELx_IDX(por, pkey); 22 23 return perm & POE_W; 24 } 25 26 static inline bool por_elx_allows_exec(u64 por, u8 pkey) 27 { 28 u8 perm = POR_ELx_IDX(por, pkey); 29 30 return perm & POE_X; 31 } 32 33 #endif /* _ASM_ARM64_POR_H */ 34
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.