From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjUKc-0002HB-A4 for qemu-devel@nongnu.org; Thu, 21 Nov 2013 08:30:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjUKT-0003ly-Cm for qemu-devel@nongnu.org; Thu, 21 Nov 2013 08:30:06 -0500 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:58437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjUKT-0003ln-3Z for qemu-devel@nongnu.org; Thu, 21 Nov 2013 08:29:57 -0500 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 21 Nov 2013 13:29:56 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 45DD817D805A for ; Thu, 21 Nov 2013 13:29:39 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rALDTfV961341714 for ; Thu, 21 Nov 2013 13:29:41 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rALDTrr9022618 for ; Thu, 21 Nov 2013 06:29:53 -0700 Date: Thu, 21 Nov 2013 14:29:51 +0100 From: Cornelia Huck Message-ID: <20131121142951.6db2d13b@gondolin> In-Reply-To: <20131121125202.GA16253@redhat.com> References: <20131121125202.GA16253@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 for-1.7] s390x: fix flat file load on 32 bit systems List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, Dominik Dingel , Alexander Graf , Christian Borntraeger , Andreas =?UTF-8?B?RsOkcmJlcg==?= , Richard Henderson On Thu, 21 Nov 2013 14:52:02 +0200 "Michael S. Tsirkin" wrote: > pc-bios/s390-zipl.rom is a flat image so it's expected that > loading it as elf will fail. > It should fall back on loading a flat file, but doesn't > on 32 bit systems, instead it fails printing: > qemu: hardware error: could not load bootloader 's390-zipl.rom' > > The result is boot failure. > > The reason is that a 64 bit unsigned interger which is set > to -1 on error is compared to -1UL which on a 32 bit system > with gcc is a 32 bit unsigned interger. > Since both are unsigned, no sign extension takes place and > comparison evaluates to non-equal. > > There's no reason to do clever tricks: all functions > we call actually return int so just use int. > In fact ram_addr_t dos not make any sense - > it's meaning is "memory handle for migration". > > And then we can use == -1 everywhere, consistently. > > Signed-off-by: Michael S. Tsirkin > --- > > Changes from v1: > better fix: use int everywhere > fix all places with same bug (e.g. -kernel was broken too) > > hw/s390x/ipl.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > Reviewed-by: Cornelia Huck