From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cD7NX-0004ig-TG for qemu-devel@nongnu.org; Sat, 03 Dec 2016 05:17:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD7NU-0005Lg-JT for qemu-devel@nongnu.org; Sat, 03 Dec 2016 05:17:11 -0500 References: <1480524257-28225-1-git-send-email-yongbok.kim@imgtec.com> From: Thomas Huth Message-ID: Date: Sat, 3 Dec 2016 11:17:02 +0100 MIME-Version: 1.0 In-Reply-To: <1480524257-28225-1-git-send-email-yongbok.kim@imgtec.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-mips: fix bad shifts in {dextp|dextpdp} List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yongbok Kim , qemu-devel@nongnu.org Cc: proljc@gmail.com, aurelien@aurel32.net, qemu-trivial@nongnu.org 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 > Reported-by: Jia Liu > Signed-off-by: Yongbok Kim > --- > 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