summaryrefslogtreecommitdiff
path: root/target-ppc/excp_helper.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-07-27 16:56:30 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2016-09-07 12:37:48 +1000
commite41029b378b4a65a0b89b5a8dc087aca6b5d012d (patch)
tree86fc95b9bd375b3644c91e480cba440d1d775c54 /target-ppc/excp_helper.c
parent1b7d17cae4c31e7cf16abd7036f5a5ca5dee8c57 (diff)
downloadqemu-e41029b378b4a65a0b89b5a8dc087aca6b5d012d.zip
ppc: Don't update NIP in lswi/lswx/stswi/stswx
Instead, pass GETPC() result to the corresponding helpers. This requires a bit of fiddling to get the PC (hopefully) right in the case where we generate a program check, though the hacks there are temporary, a subsequent patch will clean this all up by always having the nip already set to the right instruction when taking the fault. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [dwg: Fix trivial checkpatch warning] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target-ppc/excp_helper.c')
-rw-r--r--target-ppc/excp_helper.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
index 02d9e79e79..6aa03295e0 100644
--- a/target-ppc/excp_helper.c
+++ b/target-ppc/excp_helper.c
@@ -285,6 +285,10 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
LOG_EXCP("Invalid instruction at " TARGET_FMT_lx "\n", env->nip);
msr |= 0x00080000;
env->spr[SPR_BOOKE_ESR] = ESR_PIL;
+ /* Some invalids will have the PC in the right place already */
+ if (env->error_code & POWERPC_EXCP_INVAL_LSWX) {
+ goto store_next;
+ }
break;
case POWERPC_EXCP_PRIV:
msr |= 0x00040000;
@@ -306,6 +310,10 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
srr1 = SPR_HSRR1;
new_msr |= (target_ulong)MSR_HVB;
new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
+ /* Some invalids will have the PC in the right place already */
+ if (env->error_code == (POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_LSWX)) {
+ goto store_next;
+ }
goto store_current;
case POWERPC_EXCP_FPU: /* Floating-point unavailable exception */
goto store_current;