qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-mips: fix bad shifts in {dextp|dextpdp}
@ 2016-11-30 16:44 Yongbok Kim
  2016-12-03 10:17 ` Thomas Huth
  0 siblings, 1 reply; 2+ messages in thread
From: Yongbok Kim @ 2016-11-30 16:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: aurelien, thuth, proljc

Fixed issues in the MIPSDSP64 instructions dextp and dextpdp.
Shifting can go out of 32 bit range.

https://bugs.launchpad.net/qemu/+bug/1631625

Reported-by: Thomas Huth <thuth@redhat.com>
Reported-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
---
 target-mips/dsp_helper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
index df7d220..dc70793 100644
--- a/target-mips/dsp_helper.c
+++ b/target-mips/dsp_helper.c
@@ -3477,7 +3477,7 @@ target_ulong helper_dextp(target_ulong ac, target_ulong size, CPUMIPSState *env)
 
     if (sub >= -1) {
         temp = (tempB << (64 - len)) | (tempA >> len);
-        temp = temp & ((0x01 << (size + 1)) - 1);
+        temp = temp & ((1ULL << (size + 1)) - 1);
         set_DSPControl_efi(0, env);
     } else {
         set_DSPControl_efi(1, env);
@@ -3506,7 +3506,7 @@ target_ulong helper_dextpdp(target_ulong ac, target_ulong size,
 
     if (sub >= -1) {
         temp = (tempB << (64 - len)) | (tempA >> len);
-        temp = temp & ((0x01 << (size + 1)) - 1);
+        temp = temp & ((1ULL << (size + 1)) - 1);
         set_DSPControl_pos(sub, env);
         set_DSPControl_efi(0, env);
     } else {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] target-mips: fix bad shifts in {dextp|dextpdp}
  2016-11-30 16:44 [Qemu-devel] [PATCH] target-mips: fix bad shifts in {dextp|dextpdp} Yongbok Kim
@ 2016-12-03 10:17 ` Thomas Huth
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Huth @ 2016-12-03 10:17 UTC (permalink / raw)
  To: Yongbok Kim, qemu-devel; +Cc: proljc, aurelien, qemu-trivial

On 30.11.2016 17:44, Yongbok Kim wrote:
> Fixed issues in the MIPSDSP64 instructions dextp and dextpdp.
> Shifting can go out of 32 bit range.
> 
> https://bugs.launchpad.net/qemu/+bug/1631625
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Reported-by: Jia Liu <proljc@gmail.com>
> Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
> ---
>  target-mips/dsp_helper.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
> index df7d220..dc70793 100644
> --- a/target-mips/dsp_helper.c
> +++ b/target-mips/dsp_helper.c
> @@ -3477,7 +3477,7 @@ target_ulong helper_dextp(target_ulong ac, target_ulong size, CPUMIPSState *env)
>  
>      if (sub >= -1) {
>          temp = (tempB << (64 - len)) | (tempA >> len);
> -        temp = temp & ((0x01 << (size + 1)) - 1);
> +        temp = temp & ((1ULL << (size + 1)) - 1);
>          set_DSPControl_efi(0, env);
>      } else {
>          set_DSPControl_efi(1, env);
> @@ -3506,7 +3506,7 @@ target_ulong helper_dextpdp(target_ulong ac, target_ulong size,
>  
>      if (sub >= -1) {
>          temp = (tempB << (64 - len)) | (tempA >> len);
> -        temp = temp & ((0x01 << (size + 1)) - 1);
> +        temp = temp & ((1ULL << (size + 1)) - 1);
>          set_DSPControl_pos(sub, env);
>          set_DSPControl_efi(0, env);
>      } else {
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-03 10:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 16:44 [Qemu-devel] [PATCH] target-mips: fix bad shifts in {dextp|dextpdp} Yongbok Kim
2016-12-03 10:17 ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).