Exception ADEM/ADEF need update CSR_BADV, the value from the virtual address.

Signed-off-by: Song Gao <[email protected]>
---
 target/loongarch/tcg/tcg_cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/loongarch/tcg/tcg_cpu.c b/target/loongarch/tcg/tcg_cpu.c
index c05a06eeb5..8615e03d14 100644
--- a/target/loongarch/tcg/tcg_cpu.c
+++ b/target/loongarch/tcg/tcg_cpu.c
@@ -225,6 +225,7 @@ static void loongarch_cpu_do_transaction_failed(CPUState 
*cs, hwaddr physaddr,
 {
     CPULoongArchState *env = cpu_env(cs);
 
+    env->CSR_BADV = addr;
     if (access_type == MMU_INST_FETCH) {
         do_raise_exception(env, EXCCODE_ADEF, retaddr);
     } else {
-- 
2.47.3


Reply via email to