|
From: openocd-gerrit <ope...@us...> - 2026-10-23 04:26:43
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via c3cda13d215b1679817a492f54ef194212e01752 (commit)
from 87075a144bad4404a9d70884ce0b469575b9f0ae (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c3cda13d215b1679817a492f54ef194212e01752
Author: Farid Khaydari <kha...@gm...>
Date: Tue Aug 18 16:55:01 2026 +0300
target/riscv: clear a stale MPRV on a physical progbuf access
Unless dcsr.mprven is reset, a physical request can be accidentally
translated due to stale mstatus.MPRV.
Change-Id: I849f8a655e1fbee10a728cdc0974af1d6390189d
Signed-off-by: Farid Khaydari <kha...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9935
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <eu...@gm...>
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 7c8d36f06..faf65c8e6 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -12120,6 +12120,7 @@ read the respective entries). This is the default mode.
(Virtual memory access will fail with an error if the hardware doesn't
support the necessary functionality.)
@item @option{off} - Virtual addresses are not translated (identity mapping is assumed).
+An access in this mode behaves exactly like an explicitly physical one.
@end itemize
Returns current translation mode if called without arguments.
@end deffn
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 9205d6ae3..48ea26b09 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -3319,23 +3319,22 @@ static int modify_privilege_progbuf(struct target *target, riscv_reg_t *mstatus,
assert(mstatush_old);
assert(dcsr);
assert(dcsr_old);
- if (mode == RISCV_MODE_M)
- return ERROR_OK;
if (riscv_reg_get(target, dcsr, GDB_REGNO_DCSR) != ERROR_OK)
return ERROR_FAIL;
*dcsr_old = *dcsr;
- if (set_mpp_mpv(target, mstatus, mstatus_old, mstatush, mstatush_old, mode) != ERROR_OK)
- return ERROR_FAIL;
-
- *dcsr = set_field(*dcsr, CSR_DCSR_MPRVEN, CSR_DCSR_MPRVEN_ENABLED);
+ *dcsr = set_field(*dcsr, CSR_DCSR_MPRVEN, mode == RISCV_MODE_M ?
+ CSR_DCSR_MPRVEN_DISABLED : CSR_DCSR_MPRVEN_ENABLED);
if (*dcsr != *dcsr_old &&
riscv_reg_set(target, GDB_REGNO_DCSR, *dcsr) != ERROR_OK)
return ERROR_FAIL;
- return ERROR_OK;
+ if (mode == RISCV_MODE_M)
+ return ERROR_OK;
+
+ return set_mpp_mpv(target, mstatus, mstatus_old, mstatush, mstatush_old, mode);
}
static int restore_privilege_progbuf(struct target *target, riscv_reg_t mstatus, riscv_reg_t mstatus_old,
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 1 +
src/target/riscv/riscv-013.c | 13 ++++++-------
2 files changed, 7 insertions(+), 7 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|