target/riscv: Fix privilege mode of G-stage translation for debugging
PATCH 1/1 target/riscv: Fix privilege mode of G-stage translation for debugging
G-stage translation should be considered to be user-level access in riscv_cpu_get_phys_page_debug(), as already done in riscv_cpu_tlb_fill().
This fixes a bug that prevents gdb from reading memory while the VM is running in VS-mode.
--- target/riscv/cpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu_helper.c +1 -1
@@ -1212,7 +1212,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)if (env->virt_enabled) {if (get_physical_address (env, &phys_addr, &prot, phys_addr,NULL , -0 , mmu_idx, false, true, true)) { +0 , MMUIdx_U, false, true, true)) {return -1 ; } }
Signature · 1 line
2.43.2
Quoted 4 lines · Hiroaki Yamamoto
G-stage translation should be considered to be user-level access in
riscv_cpu_get_phys_page_debug(), as already done inriscv_cpu_tlb_fill().This fixes a bug that prevents gdb from reading memory while the VM is running in VS-mode.
Thanks for the patch. In the future can you ensure your commit message wraps at around 70 characters?
Quoted 2 lines
Signed-off-by Hiroaki Yamamoto <[email protected]>
Alistair
Quoted 21 lines
--- target/riscv/cpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/riscv/cpu_helper.c +1
-2@@ -1212,7 +1212,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)if (env->virt_enabled) {if (get_physical_address (env, &phys_addr, &prot, phys_addr,NULL , -0 , mmu_idx, false, true, true)) { +0 , MMUIdx_U, false, true, true)) {return -1 ; } } --2.43.2
Alistair Francis
AppliedQuoted 6 lines · Hiroaki Yamamoto
G-stage translation should be considered to be user-level access in
riscv_cpu_get_phys_page_debug(), as already done inriscv_cpu_tlb_fill().This fixes a bug that prevents gdb from reading memory while the VM is running in VS-mode.
Signed-off-by Hiroaki Yamamoto <[email protected]>
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 21 lines
--- target/riscv/cpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/riscv/cpu_helper.c +1
-2@@ -1212,7 +1212,7 @@ hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)if (env->virt_enabled) {if (get_physical_address (env, &phys_addr, &prot, phys_addr,NULL , -0 , mmu_idx, false, true, true)) { +0 , MMUIdx_U, false, true, true)) {return -1 ; } } --2.43.2