From 9d2ff967999836293e424ef697a9a065f070dc50 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 1 Aug 2018 16:23:02 -0700 Subject: Un-mix trap and exception in {m,s}epc This might be a bit pedantic, but the current wording in the spec mixes up traps and execptions here in a way that makes it sound like interrupts don't write {m,s}epc if you're reading quickly. I don't really like the wording I've proposed, so this is more of a bug report than a fix. --- src/machine.tex | 5 +++-- src/supervisor.tex | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/machine.tex b/src/machine.tex index 34b3b3d..edfd53f 100644 --- a/src/machine.tex +++ b/src/machine.tex @@ -1723,8 +1723,9 @@ addresses. Implementations may convert some invalid address patterns into other invalid addresses prior to writing them to {\tt mepc}. When a trap is taken into M-mode, {\tt mepc} is written with the virtual -address of the instruction that encountered the exception. Otherwise, -{\tt mepc} is never written by the implementation, though it may be +address of the instruction that encountered the exception or the virtual +address of the next instruction to be executed in the interrupted context. +Otherwise, {\tt mepc} is never written by the implementation, though it may be explicitly written by software. \begin{figure}[h!] diff --git a/src/supervisor.tex b/src/supervisor.tex index bd432a1..5e72401 100644 --- a/src/supervisor.tex +++ b/src/supervisor.tex @@ -558,8 +558,9 @@ addresses. Implementations may convert some invalid address patterns into other invalid addresses prior to writing them to {\tt sepc}. When a trap is taken into S-mode, {\tt sepc} is written with the virtual -address of the instruction that encountered the exception. Otherwise, -{\tt sepc} is never written by the implementation, though it may be +address of the instruction that encountered the exception or the virtual +address of the next instruction to be executed in the interrupted context. +Otherwise, {\tt sepc} is never written by the implementation, though it may be explicitly written by software. \begin{figure}[h!] -- cgit v1.1