diff --git a/arch/riscv/core/fatal.c b/arch/riscv/core/fatal.c index eaaca8639d2..3f2bd9a1232 100644 --- a/arch/riscv/core/fatal.c +++ b/arch/riscv/core/fatal.c @@ -94,11 +94,11 @@ void _Fault(z_arch_esf_t *esf) * treated as recoverable. */ for (int i = 0; i < ARRAY_SIZE(exceptions); i++) { - uint32_t start = (uint32_t)exceptions[i].start; - uint32_t end = (uint32_t)exceptions[i].end; + ulong_t start = (ulong_t)exceptions[i].start; + ulong_t end = (ulong_t)exceptions[i].end; if (esf->mepc >= start && esf->mepc < end) { - esf->mepc = (uint32_t)exceptions[i].fixup; + esf->mepc = (ulong_t)exceptions[i].fixup; return; } } diff --git a/arch/riscv/core/pmp/core_pmp.c b/arch/riscv/core/pmp/core_pmp.c index 0b7a81646f0..d6b53cfa074 100644 --- a/arch/riscv/core/pmp/core_pmp.c +++ b/arch/riscv/core/pmp/core_pmp.c @@ -789,7 +789,7 @@ static inline int is_in_region(uint32_t index, uint32_t start, uint32_t size) size = size == 0U ? 0U : size - 1U; #ifdef CONFIG_64BIT - if (u64_add_overflow(start, size, &end)) { + if (u64_add_overflow(start, size, (uint64_t *)&end)) { return 0; } #else diff --git a/arch/riscv/core/thread.c b/arch/riscv/core/thread.c index f23e15db0f4..05ed4d586cc 100644 --- a/arch/riscv/core/thread.c +++ b/arch/riscv/core/thread.c @@ -225,10 +225,10 @@ FUNC_NORETURN void z_riscv_user_mode_enter_syscall(k_thread_entry_t user_entry, /* Set up privileged stack */ #ifdef CONFIG_GEN_PRIV_STACKS _current->arch.priv_stack_start = - (uint32_t)z_priv_stack_find(_current->stack_obj); + (ulong_t)z_priv_stack_find(_current->stack_obj); #else _current->arch.priv_stack_start = - (uint32_t)(_current->stack_obj) + + (ulong_t)(_current->stack_obj) + Z_RISCV_STACK_GUARD_SIZE; #endif /* CONFIG_GEN_PRIV_STACKS */