kernel: Rename set/clear_ac to arch_cpu_enable/disable_user_access.
These are architecture-specific routines, so they deserve proper architecture-specific naming. The user memory access routines are already under arch_cpu (arch_cpu_user_memcpy, etc.), and the methods usually change a CPU flag, so it makes sense to put these there too. RISC-V had get_ac but nothing else defined or used it, so it's removed. No functional change intended. Change-Id: Id4715214e32f73d4a93bc7ba8249411a0878d174 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8106 Reviewed-by: waddlesplash <[email protected]> Reviewed-by: X512 X512 <[email protected]> Reviewed-by: Jérôme Duval <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
dadc497fbc
commit
6f88de113d
@@ -16,8 +16,8 @@
|
||||
#define dmb() __asm__ __volatile__("dmb" : : : "memory")
|
||||
#define wfi() __asm__ __volatile__("wfi" : : : "memory")
|
||||
|
||||
#define set_ac()
|
||||
#define clear_ac()
|
||||
#define arch_cpu_enable_user_access()
|
||||
#define arch_cpu_disable_user_access()
|
||||
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#define CACHE_LINE_SIZE 64
|
||||
|
||||
// TODO: These will require a real implementation when PAN is enabled
|
||||
#define set_ac()
|
||||
#define clear_ac()
|
||||
#define arch_cpu_enable_user_access()
|
||||
#define arch_cpu_disable_user_access()
|
||||
|
||||
#include <kernel/arch/arm64/arm_registers.h>
|
||||
|
||||
|
||||
@@ -65,12 +65,12 @@ bool user_access(Function function)
|
||||
// destructor.
|
||||
auto fail = setjmp(thread_get_current_thread()->fault_handler_state);
|
||||
if (fail == 0) {
|
||||
set_ac();
|
||||
arch_cpu_enable_user_access();
|
||||
function();
|
||||
clear_ac();
|
||||
arch_cpu_disable_user_access();
|
||||
return true;
|
||||
}
|
||||
clear_ac();
|
||||
arch_cpu_disable_user_access();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#define CACHE_LINE_SIZE 16
|
||||
|
||||
|
||||
#define set_ac()
|
||||
#define clear_ac()
|
||||
#define arch_cpu_enable_user_access()
|
||||
#define arch_cpu_disable_user_access()
|
||||
|
||||
|
||||
#define SR_IP_MASK 0x0700
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
// 128 Byte lines on PPC970
|
||||
|
||||
|
||||
#define set_ac()
|
||||
#define clear_ac()
|
||||
#define arch_cpu_enable_user_access()
|
||||
#define arch_cpu_disable_user_access()
|
||||
|
||||
|
||||
struct iframe {
|
||||
|
||||
@@ -16,22 +16,15 @@
|
||||
#define CACHE_LINE_SIZE 64
|
||||
|
||||
|
||||
static inline bool
|
||||
get_ac()
|
||||
{
|
||||
return SstatusReg{.val = Sstatus()}.sum;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_ac()
|
||||
arch_cpu_enable_user_access()
|
||||
{
|
||||
SetBitsSstatus(SstatusReg{.sum = 1}.val);
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
clear_ac()
|
||||
arch_cpu_disable_user_access()
|
||||
{
|
||||
ClearBitsSstatus(SstatusReg{.sum = 1}.val);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
// 128 Byte lines on PPC970
|
||||
|
||||
|
||||
#define set_ac()
|
||||
#define clear_ac()
|
||||
#define arch_cpu_enable_user_access()
|
||||
#define arch_cpu_disable_user_access()
|
||||
|
||||
|
||||
typedef struct arch_cpu_info {
|
||||
|
||||
@@ -64,10 +64,10 @@ x86_write_cr3(size_t value)
|
||||
#define wbinvd() \
|
||||
__asm__ volatile ("wbinvd" : : : "memory")
|
||||
|
||||
#define set_ac() \
|
||||
#define arch_cpu_enable_user_access() \
|
||||
__asm__ volatile (ASM_STAC : : : "memory")
|
||||
|
||||
#define clear_ac() \
|
||||
#define arch_cpu_disable_user_access() \
|
||||
__asm__ volatile (ASM_CLAC : : : "memory")
|
||||
|
||||
#define xgetbv(reg) ({ \
|
||||
|
||||
Reference in New Issue
Block a user