arm64: uaccess: Add PAN helper
Add __uaccess_{en,dis}able_hw_pan() helpers to set/clear the PSTATE.PAN bit. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:

committed by
Catalin Marinas

parent
ed8b20d457
commit
e1281f56f1
@@ -168,6 +168,18 @@ static inline bool uaccess_ttbr0_enable(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void __uaccess_disable_hw_pan(void)
|
||||
{
|
||||
asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN,
|
||||
CONFIG_ARM64_PAN));
|
||||
}
|
||||
|
||||
static inline void __uaccess_enable_hw_pan(void)
|
||||
{
|
||||
asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN,
|
||||
CONFIG_ARM64_PAN));
|
||||
}
|
||||
|
||||
#define __uaccess_disable(alt) \
|
||||
do { \
|
||||
if (!uaccess_ttbr0_disable()) \
|
||||
|
Reference in New Issue
Block a user