From 4f1e26187e39b39f020e52e9d5a75e95ac937cc8 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 5 May 2021 01:24:57 +0000 Subject: [PATCH] riscv: Clear SUM in SSTATUS for supervisor mode exceptions. From John Baldwin 753bcca440a4d2c95f48536b586131b84c0bb87e in FreeBSD ok kettenis@ mlarkin@ --- sys/arch/riscv64/riscv64/exception.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/arch/riscv64/riscv64/exception.S b/sys/arch/riscv64/riscv64/exception.S index 7d461ff06e2..d8a7e3cc32e 100644 --- a/sys/arch/riscv64/riscv64/exception.S +++ b/sys/arch/riscv64/riscv64/exception.S @@ -83,6 +83,11 @@ sd t0, (TF_SEPC)(sp) csrr t0, sstatus sd t0, (TF_SSTATUS)(sp) +.if \el == 1 + /* Disable user address access for supervisor mode exceptions. */ + li t0, SSTATUS_SUM + csrc sstatus, t0 +.endif csrr t0, stval sd t0, (TF_STVAL)(sp) csrr t0, scause -- 2.20.1