From 01a780d51a3a0851729e1747f3787a0db4d96722 Mon Sep 17 00:00:00 2001 From: Artyom Tarasenko Date: Thu, 14 Apr 2016 21:14:31 +0200 Subject: target-sparc: fix Nucleus quad LDD 128 bit access for windowed registers Fix register offset calculation when regwptr is used. Signed-off-by: Artyom Tarasenko Reviewed-by: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland --- target-sparc/ldst_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c index b0600fd24d..658e7d8585 100644 --- a/target-sparc/ldst_helper.c +++ b/target-sparc/ldst_helper.c @@ -2059,11 +2059,11 @@ void helper_ldda_asi(CPUSPARCState *env, target_ulong addr, int asi, int rd) bswap64s(&env->gregs[rd + 1]); } } else { - env->regwptr[rd] = cpu_ldq_nucleus(env, addr); - env->regwptr[rd + 1] = cpu_ldq_nucleus(env, addr + 8); + env->regwptr[rd - 8] = cpu_ldq_nucleus(env, addr); + env->regwptr[rd + 1 - 8] = cpu_ldq_nucleus(env, addr + 8); if (asi == 0x2c) { - bswap64s(&env->regwptr[rd]); - bswap64s(&env->regwptr[rd + 1]); + bswap64s(&env->regwptr[rd - 8]); + bswap64s(&env->regwptr[rd + 1 - 8]); } } break; @@ -2076,8 +2076,8 @@ void helper_ldda_asi(CPUSPARCState *env, target_ulong addr, int asi, int rd) env->gregs[rd] = helper_ld_asi(env, addr, asi, 4, 0); env->gregs[rd + 1] = helper_ld_asi(env, addr + 4, asi, 4, 0); } else { - env->regwptr[rd] = helper_ld_asi(env, addr, asi, 4, 0); - env->regwptr[rd + 1] = helper_ld_asi(env, addr + 4, asi, 4, 0); + env->regwptr[rd - 8] = helper_ld_asi(env, addr, asi, 4, 0); + env->regwptr[rd + 1 - 8] = helper_ld_asi(env, addr + 4, asi, 4, 0); } break; } -- cgit v1.2.1 From de5f1077446ca455342db149737bdc395a7b9882 Mon Sep 17 00:00:00 2001 From: Artyom Tarasenko Date: Thu, 14 Apr 2016 21:14:32 +0200 Subject: 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. Signed-off-by: Artyom Tarasenko Reviewed-by: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland --- target-sparc/int64_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target-sparc/int64_helper.c b/target-sparc/int64_helper.c index aa876cd8ba..29360fa5fe 100644 --- a/target-sparc/int64_helper.c +++ b/target-sparc/int64_helper.c @@ -158,9 +158,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; } -- cgit v1.2.1