Skip to content

Commit a1ce63a

Browse files
zhefan.lvzqb-all
authored andcommitted
target/riscv: fix address translation in hypervisor mode
address translation don't need to care hstatus.HU
1 parent f780c27 commit a1ce63a

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

src/target/riscv/riscv.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,23 +3035,6 @@ static int riscv_mmu(struct target *target, int *enabled)
30353035
unsigned int xlen = riscv_xlen(target);
30363036

30373037
if (v_mode) {
3038-
/* vsatp and hgatp registers are considered active for the
3039-
* purposes of the address-translation algorithm unless the
3040-
* effective privilege mode is U and hstatus.HU=0. */
3041-
if (effective_mode == PRV_U) {
3042-
riscv_reg_t hstatus;
3043-
if (riscv_reg_get(target, &hstatus, GDB_REGNO_HSTATUS) != ERROR_OK) {
3044-
LOG_TARGET_ERROR(target, "Failed to read hstatus register.");
3045-
return ERROR_FAIL;
3046-
}
3047-
3048-
if (get_field(hstatus, HSTATUS_HU) == 0)
3049-
/* In hypervisor mode regular satp translation
3050-
* doesn't happen. */
3051-
return ERROR_OK;
3052-
3053-
}
3054-
30553038
riscv_reg_t vsatp;
30563039
if (riscv_reg_get(target, &vsatp, GDB_REGNO_VSATP) != ERROR_OK) {
30573040
LOG_TARGET_ERROR(target, "Failed to read vsatp register; priv=0x%" PRIx64,

0 commit comments

Comments
 (0)