From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a464V-0000ig-0u for qemu-devel@nongnu.org; Wed, 02 Dec 2015 06:59:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a464Q-0000G2-1I for qemu-devel@nongnu.org; Wed, 02 Dec 2015 06:59:42 -0500 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:32935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a464P-0000Fc-RN for qemu-devel@nongnu.org; Wed, 02 Dec 2015 06:59:37 -0500 Received: by wmec201 with SMTP id c201so249584843wme.0 for ; Wed, 02 Dec 2015 03:59:37 -0800 (PST) Sender: Paolo Bonzini References: <20151201175357.GC1788@perard.uk.xensource.com> <565EC83D.9020907@redhat.com> From: Paolo Bonzini Message-ID: <565EDD23.4040705@redhat.com> Date: Wed, 2 Dec 2015 12:59:31 +0100 MIME-Version: 1.0 In-Reply-To: <565EC83D.9020907@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Regression: Xen guest with 5G of RAM on 32bit fail to boot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony PERARD , QEMU-devel Cc: Juan Quintela , Xen Devel , "Dr. David Alan Gilbert" , Stefano Stabellini On 02/12/2015 11:30, Paolo Bonzini wrote: > diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h > index f9998b9..87a4145 100644 > --- a/include/exec/cpu-all.h > +++ b/include/exec/cpu-all.h > @@ -174,11 +174,10 @@ extern unsigned long reserved_va; > #define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1) > #define TARGET_PAGE_ALIGN(addr) (((addr) + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK) > > -/* ??? These should be the larger of uintptr_t and target_ulong. */ > extern uintptr_t qemu_real_host_page_size; > -extern uintptr_t qemu_real_host_page_mask; > +extern intptr_t qemu_real_host_page_mask; > extern uintptr_t qemu_host_page_size; > -extern uintptr_t qemu_host_page_mask; > +extern intptr_t qemu_host_page_mask; > > #define HOST_PAGE_ALIGN(addr) (((addr) + qemu_host_page_size - 1) & qemu_host_page_mask) > #define REAL_HOST_PAGE_ALIGN(addr) (((addr) + qemu_real_host_page_size - 1) & \ > diff --git a/translate-all.c b/translate-all.c > index a940bd2..7a15109 100644 > --- a/translate-all.c > +++ b/translate-all.c > @@ -118,7 +118,7 @@ typedef struct PageDesc { > #define V_L1_SHIFT (L1_MAP_ADDR_SPACE_BITS - TARGET_PAGE_BITS - V_L1_BITS) > > uintptr_t qemu_host_page_size; > -uintptr_t qemu_host_page_mask; > +intptr_t qemu_host_page_mask; > > /* The bottom level has pointers to PageDesc */ > static void *l1_map[V_L1_SIZE]; > @@ -326,14 +326,14 @@ void page_size_init(void) > /* NOTE: we can always suppose that qemu_host_page_size >= > TARGET_PAGE_SIZE */ > qemu_real_host_page_size = getpagesize(); > - qemu_real_host_page_mask = ~(qemu_real_host_page_size - 1); > + qemu_real_host_page_mask = -(intptr_t)qemu_real_host_page_size; > if (qemu_host_page_size == 0) { > qemu_host_page_size = qemu_real_host_page_size; > } > if (qemu_host_page_size < TARGET_PAGE_SIZE) { > qemu_host_page_size = TARGET_PAGE_SIZE; > } > - qemu_host_page_mask = ~(qemu_host_page_size - 1); > + qemu_host_page_mask = -(intptr_t)qemu_host_page_size; > } > > static void page_init(void) > diff --git a/translate-common.c b/translate-common.c > index 619feb4..171222d 100644 > --- a/translate-common.c > +++ b/translate-common.c > @@ -21,7 +21,7 @@ > #include "qom/cpu.h" > > uintptr_t qemu_real_host_page_size; > -uintptr_t qemu_real_host_page_mask; > +intptr_t qemu_real_host_page_mask; > > #ifndef CONFIG_USER_ONLY > /* mask must never be zero, except for A20 change call */ > > Ok, I tested this by adding + assert(HOST_PAGE_ALIGN(0x123456700ll) == 0x123457000ll); + assert(REAL_HOST_PAGE_ALIGN(0x123456700ll) == 0x123457000ll); and doing a 32-bit x86_64-linux-user build. Since Dave's patch does not compile for user-mode emulation (ram_addr_t is a softmmu concept), I'm queuing my patch for 2.5. Paolo