On 2025/12/30 下午7:30, Song Gao wrote:
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 {
Reviewed-by: Bibo Mao <[email protected]>