arch: riscv: pmp: Fix is_user_mode in RV64

Currently, is_user_mode is 8-byte in riscv64 and it breaks a 4-byte PMP
region protecting it. Because is_user_mode is a single flag, we could
just fix it's size to 4-byte in both riscv32 and riscv64.

Signed-off-by: Jim Shu <cwshu09@gmail.com>
This commit is contained in:
Jim Shu 2022-01-15 18:48:36 +08:00 committed by Anas Nashif
commit fd2c07682e
3 changed files with 3 additions and 3 deletions

View file

@ -68,7 +68,7 @@ struct riscv_pmp_region {
};
#ifdef CONFIG_USERSPACE
extern ulong_t is_user_mode;
extern uint32_t is_user_mode;
#endif
/*

View file

@ -17,7 +17,7 @@
* Glogal variable used to know the current mode running.
* Is not boolean because it must match the PMP granularity of the arch.
*/
ulong_t is_user_mode;
uint32_t is_user_mode;
bool irq_flag;
#endif

View file

@ -151,7 +151,7 @@ static inline uintptr_t arch_syscall_invoke0(uintptr_t call_id)
static inline bool arch_is_user_context(void)
{
/* Defined in arch/riscv/core/thread.c */
extern ulong_t is_user_mode;
extern uint32_t is_user_mode;
return is_user_mode;
}