From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kl0z1-0004hh-P5 for qemu-devel@nongnu.org; Wed, 01 Oct 2008 08:39:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kl0z0-0004gp-PH for qemu-devel@nongnu.org; Wed, 01 Oct 2008 08:39:11 -0400 Received: from [199.232.76.173] (port=40988 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kl0z0-0004gZ-JR for qemu-devel@nongnu.org; Wed, 01 Oct 2008 08:39:10 -0400 Received: from hall.aurel32.net ([88.191.82.174]:41088) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kl0yz-0004m7-Pg for qemu-devel@nongnu.org; Wed, 01 Oct 2008 08:39:10 -0400 Received: from volta.aurel32.net ([2002:52e8:2fb:1:21e:8cff:feb0:693b]) by hall.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Kl0yt-0003yh-6Q for qemu-devel@nongnu.org; Wed, 01 Oct 2008 14:39:03 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1Kl0yo-0000L9-Kt for qemu-devel@nongnu.org; Wed, 01 Oct 2008 14:38:58 +0200 Date: Wed, 1 Oct 2008 14:38:58 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] x86 MMX register access problem seen on Sparc host Message-ID: <20081001123858.GA20525@volta.aurel32.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mon, Sep 22, 2008 at 01:44:55AM +0400, malc wrote: > On Mon, 22 Sep 2008, malc wrote: > >> On Sun, 21 Sep 2008, Blue Swirl wrote: >> >>> Hi, >>> >>> I get these warnings when compiling i386 targets on Sparc host using a >>> gcc 4.3 series compiler: >>> /src/qemu/target-i386/ops_sse.h: In function 'helper_pmovmskb_mmx': >>> /src/qemu/target-i386/ops_sse.h:982: warning: array subscript is above >>> array bounds >>> etc. >>> >>> The first line is the following: >>> val |= (s->XMM_B(0) >> 7); >> >> All the lines before #if SHIFT == 1 should be MMX_B really. > > Scratch that. It should be this instead: Acked-By: Care to commit the patch? > diff --git a/target-i386/ops_sse.h b/target-i386/ops_sse.h > index 7568681..2b594db 100644 > --- a/target-i386/ops_sse.h > +++ b/target-i386/ops_sse.h > @@ -979,23 +979,23 @@ uint32_t glue(helper_pmovmskb, SUFFIX)(Reg *s) > { > uint32_t val; > val = 0; > - val |= (s->XMM_B(0) >> 7); > - val |= (s->XMM_B(1) >> 6) & 0x02; > - val |= (s->XMM_B(2) >> 5) & 0x04; > - val |= (s->XMM_B(3) >> 4) & 0x08; > - val |= (s->XMM_B(4) >> 3) & 0x10; > - val |= (s->XMM_B(5) >> 2) & 0x20; > - val |= (s->XMM_B(6) >> 1) & 0x40; > - val |= (s->XMM_B(7)) & 0x80; > + val |= (s->B(0) >> 7); > + val |= (s->B(1) >> 6) & 0x02; > + val |= (s->B(2) >> 5) & 0x04; > + val |= (s->B(3) >> 4) & 0x08; > + val |= (s->B(4) >> 3) & 0x10; > + val |= (s->B(5) >> 2) & 0x20; > + val |= (s->B(6) >> 1) & 0x40; > + val |= (s->B(7)) & 0x80; > #if SHIFT == 1 > - val |= (s->XMM_B(8) << 1) & 0x0100; > - val |= (s->XMM_B(9) << 2) & 0x0200; > - val |= (s->XMM_B(10) << 3) & 0x0400; > - val |= (s->XMM_B(11) << 4) & 0x0800; > - val |= (s->XMM_B(12) << 5) & 0x1000; > - val |= (s->XMM_B(13) << 6) & 0x2000; > - val |= (s->XMM_B(14) << 7) & 0x4000; > - val |= (s->XMM_B(15) << 8) & 0x8000; > + val |= (s->B(8) << 1) & 0x0100; > + val |= (s->B(9) << 2) & 0x0200; > + val |= (s->B(10) << 3) & 0x0400; > + val |= (s->B(11) << 4) & 0x0800; > + val |= (s->B(12) << 5) & 0x1000; > + val |= (s->B(13) << 6) & 0x2000; > + val |= (s->B(14) << 7) & 0x4000; > + val |= (s->B(15) << 8) & 0x8000; > #endif > return val; > } > >> >>> >>> In cpu.h, the macro is defined on big endian host as >>> #define XMM_B(n) _b[15 - (n)] >>> >>> But the type of Reg argument is MMXReg for pmovmskb_mmx and then the >>> _b array has only 8 items. >>> >>> >> >> > > -- > mailto:av1474@comtv.ru > > > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net