]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user/ppc: Report correct fault address for data faults
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 6 Nov 2017 18:33:24 +0000 (18:33 +0000)
committerRiku Voipio <riku.voipio@linaro.org>
Tue, 7 Nov 2017 19:58:43 +0000 (21:58 +0200)
For faults on loads and stores, ppc_cpu_handle_mmu_fault() in
target/ppc/user_only_helper.c stores the offending address
in env->spr[SPR_DAR]. Report this correctly to the guest
in si_addr, rather than incorrectly using the address of the
instruction that caused the fault.

This fixes the test case in
https://bugs.launchpad.net/qemu/+bug/1077116
for ppc, ppc64 and ppc64le.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/main.c

index b6dd9efd2d9454d430e30235781cc8ba14b89b83..6286661bd36bf5e68d5c0505d5045a7ecbbf3a67 100644 (file)
@@ -1420,7 +1420,7 @@ void cpu_loop(CPUPPCState *env)
                 info.si_code = TARGET_SEGV_MAPERR;
                 break;
             }
-            info._sifields._sigfault._addr = env->nip;
+            info._sifields._sigfault._addr = env->spr[SPR_DAR];
             queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
             break;
         case POWERPC_EXCP_ISI:      /* Instruction storage exception         */