From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBtTG-0006oD-2c for qemu-devel@nongnu.org; Mon, 28 Jul 2014 18:32:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBtTE-0002l0-Pf for qemu-devel@nongnu.org; Mon, 28 Jul 2014 18:32:42 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:37903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBtTE-0002kl-K0 for qemu-devel@nongnu.org; Mon, 28 Jul 2014 18:32:40 -0400 Date: Tue, 29 Jul 2014 00:32:36 +0200 From: Aurelien Jarno Message-ID: <20140728223236.GC18733@ohm.rr44.fr> References: <1406563102-11035-1-git-send-email-elta.era@gmail.com> <1406563102-11035-2-git-send-email-elta.era@gmail.com> <20140728214242.GA24813@ohm.rr44.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 2/2] target-mips/translate.c: Add judgement for msb and lsb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Dongxue Zhang , QEMU Developers On Mon, Jul 28, 2014 at 11:01:02PM +0100, Peter Maydell wrote: > On 28 July 2014 22:42, Aurelien Jarno wrote: > > On Mon, Jul 28, 2014 at 11:58:22PM +0800, Dongxue Zhang wrote: > >> Use 'if' to make sure the real msb greater than the lsb. As the compiler may > >> not do this. > > > > What are you trying to fix exactly? These cases are defined as > > "unpredictable" in the MIPS ISA manual, which is what is implemented in > > QEMU. > > This may be true, but the TCG README doesn't define negative > lengths as being "unspecified behaviour" (ie guaranteed to at > least not crash even if the result isn't specified), and in fact the > implementation of tcg_gen_deposit will assert on negative lengths. > We shouldn't implement guest unpredictable cases as "crash QEMU". Well I tried this code under QEMU, and it clearly doesn't crash. It seems the assert are not enabled with the default configuration options. That said I agree it's something to avoid, but I don't think triggering a RI exception is the thing to do (even if it is correct according the MIPS ISA manual) when real silicon output a random result instead. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net