All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Petar Jovanovic <petar.jovanovic@rt-rk.com>
Cc: qemu-trivial@nongnu.org, petar.jovanovic@imgtec.com,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-trivial] [PATCH] target-mips: fix incorrect behaviour for INSV
Date: Wed, 08 May 2013 16:41:44 +0400	[thread overview]
Message-ID: <518A4808.40203@msgid.tls.msk.ru> (raw)
In-Reply-To: <1368011861-57373-1-git-send-email-petar.jovanovic@rt-rk.com>

08.05.2013 15:17, Petar Jovanovic wrote:
> From: Petar Jovanovic <petar.jovanovic@imgtec.com>
> 
> Corner case for INSV instruction when size=32 has not been correctly
> implemented. The mask for size should be one bit wider, and preparing the
> filter variable should be aware of this case too.
> 
> The test for INSV has been extended to include the case that triggers the
> bug.

This isn't really a good fit for a trivial patch.  Cc'ing qemu-devel
and mips "odd-fixes" maintainer instead.

Thanks!

/mjt

> Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
> ---
>  target-mips/dsp_helper.c         |    4 ++--
>  tests/tcg/mips/mips32-dsp/insv.c |   13 +++++++++++++
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
> index 805247d..9212789 100644
> --- a/target-mips/dsp_helper.c
> +++ b/target-mips/dsp_helper.c
> @@ -2921,7 +2921,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs,  \
>          return rt;                                              \
>      }                                                           \
>                                                                  \
> -    filter = ((int32_t)0x01 << size) - 1;                       \
> +    filter = ((int64_t)0x01 << size) - 1;                       \
>      filter = filter << pos;                                     \
>      temprs = (rs << pos) & filter;                              \
>      temprt = rt & ~filter;                                      \
> @@ -2930,7 +2930,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs,  \
>      return (target_long)(ret_type)temp;                         \
>  }
>  
> -BIT_INSV(insv, 0x1F, 0x1F, int32_t);
> +BIT_INSV(insv, 0x1F, 0x3F, int32_t);
>  #ifdef TARGET_MIPS64
>  BIT_INSV(dinsv, 0x7F, 0x3F, target_long);
>  #endif
> diff --git a/tests/tcg/mips/mips32-dsp/insv.c b/tests/tcg/mips/mips32-dsp/insv.c
> index 243b007..9d67469 100644
> --- a/tests/tcg/mips/mips32-dsp/insv.c
> +++ b/tests/tcg/mips/mips32-dsp/insv.c
> @@ -19,5 +19,18 @@ int main()
>          );
>      assert(rt == result);
>  
> +    dsp    = 0x1000;
> +    rt     = 0xF0F0F0F0;
> +    rs     = 0xA5A5A5A5;
> +    result = 0xA5A5A5A5;
> +
> +    __asm
> +        ("wrdsp %2\n\t"
> +         "insv  %0, %1\n\t"
> +         : "+r"(rt)
> +         : "r"(rs), "r"(dsp)
> +        );
> +    assert(rt == result);
> +
>      return 0;
>  }
> 



WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: Petar Jovanovic <petar.jovanovic@rt-rk.com>
Cc: qemu-trivial@nongnu.org, petar.jovanovic@imgtec.com,
	Aurelien Jarno <aurelien@aurel32.net>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] target-mips: fix incorrect behaviour for INSV
Date: Wed, 08 May 2013 16:41:44 +0400	[thread overview]
Message-ID: <518A4808.40203@msgid.tls.msk.ru> (raw)
In-Reply-To: <1368011861-57373-1-git-send-email-petar.jovanovic@rt-rk.com>

08.05.2013 15:17, Petar Jovanovic wrote:
> From: Petar Jovanovic <petar.jovanovic@imgtec.com>
> 
> Corner case for INSV instruction when size=32 has not been correctly
> implemented. The mask for size should be one bit wider, and preparing the
> filter variable should be aware of this case too.
> 
> The test for INSV has been extended to include the case that triggers the
> bug.

This isn't really a good fit for a trivial patch.  Cc'ing qemu-devel
and mips "odd-fixes" maintainer instead.

Thanks!

/mjt

> Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
> ---
>  target-mips/dsp_helper.c         |    4 ++--
>  tests/tcg/mips/mips32-dsp/insv.c |   13 +++++++++++++
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
> index 805247d..9212789 100644
> --- a/target-mips/dsp_helper.c
> +++ b/target-mips/dsp_helper.c
> @@ -2921,7 +2921,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs,  \
>          return rt;                                              \
>      }                                                           \
>                                                                  \
> -    filter = ((int32_t)0x01 << size) - 1;                       \
> +    filter = ((int64_t)0x01 << size) - 1;                       \
>      filter = filter << pos;                                     \
>      temprs = (rs << pos) & filter;                              \
>      temprt = rt & ~filter;                                      \
> @@ -2930,7 +2930,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs,  \
>      return (target_long)(ret_type)temp;                         \
>  }
>  
> -BIT_INSV(insv, 0x1F, 0x1F, int32_t);
> +BIT_INSV(insv, 0x1F, 0x3F, int32_t);
>  #ifdef TARGET_MIPS64
>  BIT_INSV(dinsv, 0x7F, 0x3F, target_long);
>  #endif
> diff --git a/tests/tcg/mips/mips32-dsp/insv.c b/tests/tcg/mips/mips32-dsp/insv.c
> index 243b007..9d67469 100644
> --- a/tests/tcg/mips/mips32-dsp/insv.c
> +++ b/tests/tcg/mips/mips32-dsp/insv.c
> @@ -19,5 +19,18 @@ int main()
>          );
>      assert(rt == result);
>  
> +    dsp    = 0x1000;
> +    rt     = 0xF0F0F0F0;
> +    rs     = 0xA5A5A5A5;
> +    result = 0xA5A5A5A5;
> +
> +    __asm
> +        ("wrdsp %2\n\t"
> +         "insv  %0, %1\n\t"
> +         : "+r"(rt)
> +         : "r"(rs), "r"(dsp)
> +        );
> +    assert(rt == result);
> +
>      return 0;
>  }
> 

  reply	other threads:[~2013-05-08 12:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08 11:17 [Qemu-trivial] [PATCH] target-mips: fix incorrect behaviour for INSV Petar Jovanovic
2013-05-08 12:41 ` Michael Tokarev [this message]
2013-05-08 12:41   ` [Qemu-devel] " Michael Tokarev
2013-05-08 16:50 ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=518A4808.40203@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=petar.jovanovic@imgtec.com \
    --cc=petar.jovanovic@rt-rk.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.