From af0e282ab1775c04b8eb59757f2117f22d31d364 Mon Sep 17 00:00:00 2001 From: Artyom Tarasenko Date: Fri, 23 Feb 2018 13:39:57 -0500 Subject: [PATCH] target-sparc: fix Trap Based Address Register behavior for sparc64 Accoding the chapter 7.6 Trap Processing of the SPARC Architecture Manual v9, the Trap Based Address Register is not modified as a trap is taken. This fix allows booting FreeBSD-10.3-RELEASE-sparc64. Backports commit de5f1077446ca455342db149737bdc395a7b9882 from qemu --- qemu/target-sparc/int64_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qemu/target-sparc/int64_helper.c b/qemu/target-sparc/int64_helper.c index f9879329..8d324fb3 100644 --- a/qemu/target-sparc/int64_helper.c +++ b/qemu/target-sparc/int64_helper.c @@ -80,9 +80,8 @@ void sparc_cpu_do_interrupt(CPUState *cs) } else if ((intno & 0x1c0) == TT_FILL) { cpu_set_cwp(env, cpu_cwp_inc(env, env->cwp + 1)); } - env->tbr &= ~0x7fffULL; - env->tbr |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5); - env->pc = env->tbr; + env->pc = env->tbr & ~0x7fffULL; + env->pc |= ((env->tl > 1) ? 1 << 14 : 0) | (intno << 5); env->npc = env->pc + 4; cs->exception_index = -1; }