From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42964 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q09Bz-0003TG-Kk for qemu-devel@nongnu.org; Thu, 17 Mar 2011 05:08:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q09Bx-00008M-Nn for qemu-devel@nongnu.org; Thu, 17 Mar 2011 05:08:27 -0400 Received: from mtagate7.uk.ibm.com ([194.196.100.167]:57742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q09Bx-000086-C9 for qemu-devel@nongnu.org; Thu, 17 Mar 2011 05:08:25 -0400 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate7.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p2H98NPU032509 for ; Thu, 17 Mar 2011 09:08:23 GMT Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2H98iUV1437712 for ; Thu, 17 Mar 2011 09:08:44 GMT Received: from d06av07.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2H98MEL025201 for ; Thu, 17 Mar 2011 03:08:22 -0600 Date: Thu, 17 Mar 2011 09:08:02 +0000 From: Stefan Hajnoczi Message-ID: <20110317090802.GA4692@stefanha-thinkpad.localdomain> References: <20110315164705.11742.86706.stgit@s20.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110315164705.11742.86706.stgit@s20.home> Subject: [Qemu-devel] Re: [PATCH] pcnet: Fix sign extension: make ipxe work with >2G RAM List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: qemu-devel@nongnu.org, mcb30@ipxe.org On Tue, Mar 15, 2011 at 10:47:22AM -0600, Alex Williamson wrote: > From: Michael Brown > > The problem is with definitions in hw/pcnet.c such as: > > #define CSR_CRDA(S) ((S)->csr[28] | ((S)->csr[29] << 16)) > > "(S)->csr[29]" is a uint16_t, but "(S)->csr[29] << 16" gets promoted to > int, so the overall CSR_CRDA(s) is a (signed) int rather than a uint32_t. > > This then gets assigned to a uint64_t using > > target_phys_addr_t crda = CSR_CRDA(s); > > so when (S)->csr[29] has the high bit set, we end up with > crda=0xffffffffxxxxxxxx. > > From: Michael Brown > Signed-off-by: Alex Williamson > --- > > hw/pcnet.c | 30 +++++++++++++++--------------- > 1 files changed, 15 insertions(+), 15 deletions(-) Reviewed-by: Stefan Hajnoczi