From patchwork Tue Sep 28 19:45:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 66023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 61C48B70D8 for ; Wed, 29 Sep 2010 05:47:55 +1000 (EST) Received: from localhost ([127.0.0.1]:44297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0g9Y-0000Jv-Fl for incoming@patchwork.ozlabs.org; Tue, 28 Sep 2010 15:47:52 -0400 Received: from [140.186.70.92] (port=38531 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0g85-0007qO-1F for qemu-devel@nongnu.org; Tue, 28 Sep 2010 15:46:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0g83-0007bh-Tj for qemu-devel@nongnu.org; Tue, 28 Sep 2010 15:46:20 -0400 Received: from mail-qy0-f180.google.com ([209.85.216.180]:38973) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0g83-0007bd-RW for qemu-devel@nongnu.org; Tue, 28 Sep 2010 15:46:19 -0400 Received: by qyk5 with SMTP id 5so28145qyk.4 for ; Tue, 28 Sep 2010 12:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=7Sgmi08DkHgeeeADYgJacuxtSakfN/TIWQm9Igf591A=; b=bWAePafvBMDpAdYiAytaOFsuiGQODuU59c6b/k3XYU3IGavhFIcR5I9awxbqXBtox3 TmXl8hczJN27R1K5Yv/qVDBYIZhDUmHk+R5byHNmIG4iq601PbPAWkvooyeUtcYllkPk OTg2K3GZ1PPC5F0dslPH1e3O3oMrVfbgUTK3M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=T3vR9DVMeN4pe+2XK36EbGVo/fuiZsUL/TxgV6u3zG//HOLyzpwYd9qM2So7ZY+zeo psw5Yfw7TbMTbeEZ8UFxnxTzfF+gqbX++t0baUM6n0ZDGlsZzywEqTZ+Ho0QmunNv7au xddxPubzGAjooeHMnhupBLyk/7Iw6hZEL+6kE= Received: by 10.224.112.1 with SMTP id u1mr300668qap.273.1285703178153; Tue, 28 Sep 2010 12:46:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.236.66 with HTTP; Tue, 28 Sep 2010 12:45:56 -0700 (PDT) In-Reply-To: References: From: Blue Swirl Date: Tue, 28 Sep 2010 19:45:56 +0000 Message-ID: To: Artyom Tarasenko X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: qemu-devel Subject: [Qemu-devel] Re: "Bad ram offset"? X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Tue, Sep 28, 2010 at 7:31 PM, Artyom Tarasenko wrote: > 2010/9/28 Blue Swirl : >> On Mon, Sep 27, 2010 at 9:19 PM, Artyom Tarasenko >> wrote: >>> In today's git master: >>> >>> $ ./qemu-system-sparc64 -M sun4u -m 2048 >>> Bad ram offset ffffffff80000000 >> >> Smells like unwanted sign extension somewhere. > > fwiw, tested -m 2048 with i386 and x86-64 and they both are fine with > it. So it must be something platform-specific. In a way, on SS-20 the problem is with cpu_physical_memory_write_rom for idreg, which is at 0xef0000000. The sign extension happens in qemu_get_ram_ptr() or just before that. Here's my 'work in progress' patch: diff --git a/exec.c b/exec.c index 9b5464f..892aa06 100644 --- a/exec.c +++ b/exec.c @@ -154,7 +154,7 @@ typedef struct PageDesc { /* Size of the L2 (and L3, etc) page tables. */ #define L2_BITS 10 -#define L2_SIZE (1 << L2_BITS) +#define L2_SIZE (1ULL << L2_BITS) /* The bits remaining after N lower levels of page tables. */ #define P_L1_BITS_REM \ @@ -432,7 +432,8 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc) for (i = 0; i < L2_SIZE; i++) { pd[i].phys_offset = IO_MEM_UNASSIGNED; - pd[i].region_offset = (index + i) << TARGET_PAGE_BITS; + pd[i].region_offset = (index + (target_phys_addr_t)i) + << TARGET_PAGE_BITS; } }