Module Name:    src
Committed By:   bouyer
Date:           Sun Mar  4 15:56:09 UTC 2012

Modified Files:
        src/sys/arch/i386/i386: machdep.c

Log Message:
cast xen_start_info.nr_pages to paddr_t, so that ctob() won't truncate
the addresses to 32bits. Fix avail memory when allocating more than 4GB
to a XEN3PAE domU.


To generate a diff of this commit:
cvs rdiff -u -r1.724 -r1.725 src/sys/arch/i386/i386/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.724 src/sys/arch/i386/i386/machdep.c:1.725
--- src/sys/arch/i386/i386/machdep.c:1.724	Sat Mar  3 23:43:17 2012
+++ src/sys/arch/i386/i386/machdep.c	Sun Mar  4 15:56:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.724 2012/03/03 23:43:17 mrg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.725 2012/03/04 15:56:09 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.724 2012/03/03 23:43:17 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.725 2012/03/04 15:56:09 bouyer Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -1364,9 +1364,9 @@ init386(paddr_t first_avail)
 	/* Make sure the end of the space used by the kernel is rounded. */
 	first_avail = round_page(first_avail);
 	avail_start = first_avail;
-	avail_end = ctob(xen_start_info.nr_pages) + XPMAP_OFFSET;
+	avail_end = ctob((paddr_t)xen_start_info.nr_pages) + XPMAP_OFFSET;
 	pmap_pa_start = (KERNTEXTOFF - KERNBASE);
-	pmap_pa_end = pmap_pa_start + ctob(xen_start_info.nr_pages);
+	pmap_pa_end = pmap_pa_start + ctob((paddr_t)xen_start_info.nr_pages);
 	mem_clusters[0].start = avail_start;
 	mem_clusters[0].size = avail_end - avail_start;
 	mem_cluster_cnt++;
@@ -1419,9 +1419,10 @@ init386(paddr_t first_avail)
 	initx86_load_memmap(first_avail);
 
 #else /* !XEN */
-	XENPRINTK(("load the memory cluster %p(%d) - %p(%ld)\n",
-	    (void *)(long)avail_start, (int)atop(avail_start),
-	    (void *)(long)avail_end, (int)atop(avail_end)));
+	XENPRINTK(("load the memory cluster 0x%" PRIx64 " (%" PRId64 ") - "
+	    "0x%" PRIx64 " (%" PRId64 ")\n",
+	    (uint64_t)avail_start, (uint64_t)atop(avail_start),
+	    (uint64_t)avail_end, (uint64_t)atop(avail_end)));
 	uvm_page_physload(atop(avail_start), atop(avail_end),
 	    atop(avail_start), atop(avail_end),
 	    VM_FREELIST_DEFAULT);

Reply via email to