aboutsummaryrefslogtreecommitdiffstats
path: root/target-sparc
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-04-11 19:47:49 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-04-11 19:47:49 +0000
commitd7da2a10402f1644128b66414ca8f86bdea9ae7c (patch)
tree9d413494748513e6cedb9a284ce20e4b92d64a3b /target-sparc
parent73f190352dcef63f6e20e4b0f9efe29e6ec57b43 (diff)
Sparc: fix exceptions in delay slot
Fix a case where an exception happens with the instruction in the delay slot. Recovery of branch condition in the exception handling code was not converted to TCG. Because the condition was bogus, wrong NPC could be selected from the two candidates. A nice bug report with a test case can be found in: https://bugs.launchpad.net/qemu/+bug/551814 Fix based on patch by Fabrice Bellard. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-sparc')
-rw-r--r--target-sparc/translate.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 8b988fb5c..2c07385d5 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -4932,12 +4932,12 @@ void gen_pc_load(CPUState *env, TranslationBlock *tb,
if (npc == 1) {
/* dynamic NPC: already stored */
} else if (npc == 2) {
- target_ulong t2 = (target_ulong)(unsigned long)puc;
- /* jump PC: use T2 and the jump targets of the translation */
- if (t2)
+ /* jump PC: use 'cond' and the jump targets of the translation */
+ if (env->cond) {
env->npc = gen_opc_jump_pc[0];
- else
+ } else {
env->npc = gen_opc_jump_pc[1];
+ }
} else {
env->npc = npc;
}