git: 05504819e39d - stable/13 - riscv: Assert that SUM is not set in SSTATUS for exceptions.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 23 Nov 2021 23:48:55 UTC
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=05504819e39d12cbb0772f69e06ceb49a10fd580
commit 05504819e39d12cbb0772f69e06ceb49a10fd580
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-04-21 20:57:20 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-11-23 23:47:57 +0000
riscv: Assert that SUM is not set in SSTATUS for exceptions.
Reviewed by: mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29764
(cherry picked from commit 6a3a6fe34bf36b6e745b3e9ad1a991de057729c7)
---
sys/riscv/riscv/trap.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c
index abf527b2ef13..d378bfe1383d 100644
--- a/sys/riscv/riscv/trap.c
+++ b/sys/riscv/riscv/trap.c
@@ -280,6 +280,9 @@ do_trap_supervisor(struct trapframe *frame)
KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) ==
SSTATUS_SPP, ("Came from S mode with interrupts enabled"));
+ KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0,
+ ("Came from S mode with SUM enabled"));
+
exception = frame->tf_scause & SCAUSE_CODE;
if ((frame->tf_scause & SCAUSE_INTR) != 0) {
/* Interrupt */
@@ -348,6 +351,9 @@ do_trap_user(struct trapframe *frame)
KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
("Came from U mode with interrupts enabled"));
+ KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0,
+ ("Came from U mode with SUM enabled"));
+
exception = frame->tf_scause & SCAUSE_CODE;
if ((frame->tf_scause & SCAUSE_INTR) != 0) {
/* Interrupt */