From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzVND-0005z8-Kw for qemu-devel@nongnu.org; Tue, 24 Jun 2014 14:23:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzVN4-00025t-Jc for qemu-devel@nongnu.org; Tue, 24 Jun 2014 14:23:15 -0400 Received: from mail-qa0-x22f.google.com ([2607:f8b0:400d:c00::22f]:52383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzVN4-00025i-FJ for qemu-devel@nongnu.org; Tue, 24 Jun 2014 14:23:06 -0400 Received: by mail-qa0-f47.google.com with SMTP id hw13so579359qab.6 for ; Tue, 24 Jun 2014 11:23:05 -0700 (PDT) Sender: Richard Henderson Message-ID: <53A9C205.6070806@twiddle.net> Date: Tue, 24 Jun 2014 11:23:01 -0700 From: Richard Henderson MIME-Version: 1.0 References: <20140624043423.GX18016@ZenIV.linux.org.uk> In-Reply-To: <20140624043423.GX18016@ZenIV.linux.org.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] alpha qemu arithmetic exceptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Al Viro Cc: qemu-devel@nongnu.org On 06/23/2014 09:34 PM, Al Viro wrote: > Anyway, delta that seems to fix the gcc one (gcc.dg/pr28796-2.c from > gcc-4.3 and later) follows. Again, I'm not at all sure if handling of > env->pc in there is safe from qemu POV and I'd like like to get comments on > that from somebody more familiar with qemu guts. Thanks for the diagnosis on the gcc test case. I've been meaning to investigate some of these edge cases for quite a while and never quite got there. > static inline void inline_fp_exc_raise(CPUAlphaState *env, uintptr_t retaddr, > - uint32_t exc, uint32_t regno) > + uint32_t exc, uint32_t regno, uint32_t sw) > { > if (exc) { > - uint32_t hw_exc = 0; > + uint32_t hw_exc = sw; > > if (exc & float_flag_invalid) { > hw_exc |= EXC_M_INV; > @@ -75,7 +75,7 @@ static inline void inline_fp_exc_raise(CPUAlphaState *env, uintptr_t retaddr, > doesn't apply. */ > void helper_fp_exc_raise(CPUAlphaState *env, uint32_t exc, uint32_t regno) > { > - inline_fp_exc_raise(env, GETPC(), exc, regno); > + inline_fp_exc_raise(env, GETPC(), exc, regno, 0); > } > > /* Raise exceptions for ieee fp insns with software completion. */ > @@ -84,7 +84,7 @@ void helper_fp_exc_raise_s(CPUAlphaState *env, uint32_t exc, uint32_t regno) > if (exc) { > env->fpcr_exc_status |= exc; > exc &= ~env->fpcr_exc_mask; > - inline_fp_exc_raise(env, GETPC(), exc, regno); > + inline_fp_exc_raise(env, GETPC(), exc, regno, EXC_M_SWC); > } > } This part looks good. > diff --git a/target-alpha/helper.c b/target-alpha/helper.c > index 7c053a3..538c6b2 100644 > --- a/target-alpha/helper.c > +++ b/target-alpha/helper.c > @@ -527,6 +527,7 @@ void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr, > env->error_code = error; > if (retaddr) { > cpu_restore_state(cs, retaddr); > + env->pc += 4; This one needs a different fix, since dynamic_excp is also used from alpha_cpu_unassigned_access, and I'm pretty sure the mchk should have the address of the memory insn. But that should be easy to fix up. r~