Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/i386 cast xen_start_info.nr_pages to paddr_t, ...



details:   https://anonhg.NetBSD.org/src/rev/877f4209a951
branches:  trunk
changeset: 777785:877f4209a951
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Mar 04 15:56:09 2012 +0000

description:
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.

diffstat:

 sys/arch/i386/i386/machdep.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (44 lines):

diff -r 6138b6555be3 -r 877f4209a951 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Sun Mar 04 14:28:49 2012 +0000
+++ b/sys/arch/i386/i386/machdep.c      Sun Mar 04 15:56:09 2012 +0000
@@ -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 @@
        /* 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 @@
        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);



Home | Main Index | Thread Index | Old Index