From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZRHp-0007qd-NS for qemu-devel@nongnu.org; Tue, 08 Sep 2015 18:22:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZRHm-0007js-Ku for qemu-devel@nongnu.org; Tue, 08 Sep 2015 18:22:45 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:40483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZRHm-0007j0-2f for qemu-devel@nongnu.org; Tue, 08 Sep 2015 18:22:42 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 Sep 2015 08:22:37 +1000 Message-ID: <1441750896.2767.15.camel@au1.ibm.com> From: Benjamin Herrenschmidt Date: Wed, 09 Sep 2015 08:21:36 +1000 In-Reply-To: <20150702144406.40bce749@kryten> References: <20150702144406.40bce749@kryten> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] target-ppc: Fix SRR0 when taking unaligned exceptions Reply-To: benh@au1.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anton Blanchard , agraf@suse.de Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On Thu, 2015-07-02 at 14:44 +1000, Anton Blanchard wrote: > We are setting SRR0 to the instruction before the one causing the > unaligned exception. A quick testcase: > ../.. > p_helper.c b/target-ppc/excp_helper.c > index b803475..4250106 100644 > --- a/target-ppc/excp_helper.c > +++ b/target-ppc/excp_helper.c > @@ -200,7 +200,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, > int excp_model, int excp) > /* Get rS/rD and rA from faulting opcode */ > env->spr[SPR_DSISR] |= (cpu_ldl_code(env, (env->nip - 4)) > & 0x03FF0000) >> 16;. You need to also fix the above to use env->nip instead of env->nip - 4 when generating DSISR > - goto store_current; > + goto store_next; > case POWERPC_EXCP_PROGRAM: /* Program exception > */ > switch (env->error_code & ~0xF) { > case POWERPC_EXCP_FP: