qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] alpha qemu arithmetic exceptions


From: Richard Henderson
Subject: Re: [Qemu-devel] [RFC] alpha qemu arithmetic exceptions
Date: Tue, 24 Jun 2014 11:23:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

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~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]