From d7af8c1909a90b66bebbf07feb4ebbcd1a947763 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 16 Mar 2023 17:09:21 -0700 Subject: [PATCH 1/2] Smrnmi: clarify NMIE only affects M-mode synchronous exception behavior --- src/rnmi.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rnmi.tex b/src/rnmi.tex index d5821de0a..698440aa8 100644 --- a/src/rnmi.tex +++ b/src/rnmi.tex @@ -220,8 +220,9 @@ \section{RNMI Operation} from {\tt mnstatus}, and also sets {\tt mnstatus}.NMIE, which re-enables interrupts. -If the hart encounters an exception while the {\tt mnstatus}.NMIE bit is -clear, the actions taken are the same as if the exception had occurred while +If the hart encounters an exception while executing in M-mode +with the {\tt mnstatus}.NMIE bit clear, +the actions taken are the same as if the exception had occurred while {\tt mnstatus}.NMIE were set, except that the program counter is set to the RNMI exception trap handler address (rather than the address specified by {\tt mtvec}). From b7d01024c9aad3f94125b2e4272a9ab1b020432c Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 16 Mar 2023 17:26:36 -0700 Subject: [PATCH 2/2] MNRET clears MPRV if returning to a mode < M --- src/rnmi.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rnmi.tex b/src/rnmi.tex index 698440aa8..88ddc254d 100644 --- a/src/rnmi.tex +++ b/src/rnmi.tex @@ -204,6 +204,8 @@ \section{MNRET Instruction} {\tt mnstatus} to return to the program counter, privilege mode, and virtualization mode of the interrupted context. This instruction also sets {\tt mnstatus}.NMIE. +If MNRET changes the privilege mode to a mode +less privileged than M, it also sets {\tt mstatus}.MPRV to 0. \section{RNMI Operation}