Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/arch Pull up following revision(s) (requested by maxv...



details:   https://anonhg.NetBSD.org/src/rev/62909c45340e
branches:  netbsd-8
changeset: 850738:62909c45340e
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Jun 21 17:41:50 2017 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #42):
        sys/arch/amd64/conf/kern.ldscript: revision 1.23
        sys/arch/x86/x86/x86_machdep.c: revision 1.92
Fix a pretty dumb mistake I made in r1.22: the alignment needs to be in the
bss, otherwise the bootloader will use memory before __kernel_end and give
a wrong start pa to the kernel.
This issue was investigated by Anthony Mallet. Should fix PR/52000.
--
Fix a bug introduced in bus_space.c::r1.39. This check too is hard-coded.
Might have had a cumulative effect on PR/52000.

diffstat:

 sys/arch/amd64/conf/kern.ldscript |   6 +++---
 sys/arch/x86/x86/x86_machdep.c    |  19 ++++++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)

diffs (73 lines):

diff -r 0492722bac48 -r 62909c45340e sys/arch/amd64/conf/kern.ldscript
--- a/sys/arch/amd64/conf/kern.ldscript Wed Jun 21 17:39:24 2017 +0000
+++ b/sys/arch/amd64/conf/kern.ldscript Wed Jun 21 17:41:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern.ldscript,v 1.22 2017/02/11 16:02:11 maxv Exp $    */
+/*     $NetBSD: kern.ldscript,v 1.22.6.1 2017/06/21 17:41:50 snj Exp $ */
 
 #include "assym.h"
 
@@ -63,10 +63,10 @@
                *(.bss)
                *(.bss.*)
                *(COMMON)
-               . = ALIGN(64 / 8);
+               . = ALIGN(__LARGE_PAGE_SIZE);
        }
 
-       . = ALIGN(__LARGE_PAGE_SIZE);
+       . = ALIGN(__PAGE_SIZE);
 
        /* End of the kernel image */
        __kernel_end = . ;
diff -r 0492722bac48 -r 62909c45340e sys/arch/x86/x86/x86_machdep.c
--- a/sys/arch/x86/x86/x86_machdep.c    Wed Jun 21 17:39:24 2017 +0000
+++ b/sys/arch/x86/x86/x86_machdep.c    Wed Jun 21 17:41:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_machdep.c,v 1.91 2017/04/14 04:43:47 kamil Exp $   */
+/*     $NetBSD: x86_machdep.c,v 1.91.4.1 2017/06/21 17:41:50 snj Exp $ */
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.91 2017/04/14 04:43:47 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.91.4.1 2017/06/21 17:41:50 snj Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -514,6 +514,7 @@
 x86_add_cluster(uint64_t seg_start, uint64_t seg_end, uint32_t type)
 {
        extern struct extent *iomem_ex;
+       const uint64_t endext = MAXIOMEM + 1;
        uint64_t new_physmem = 0;
        phys_ram_seg_t *cluster;
        int i;
@@ -556,15 +557,19 @@
        }
 
        /*
-        * Allocate the physical addresses used by RAM from the iomem extent
-        * map. This is done before the addresses are page rounded just to make
+        * This cluster is used by RAM. If it is included in the iomem extent,
+        * allocate it from there, so that we won't unintentionally reuse it
+        * later with extent_alloc_region. A way to avoid collision (with UVM
+        * for example).
+        *
+        * This is done before the addresses are page rounded just to make
         * sure we get them all.
         */
-       if (seg_start < 0x100000000ULL) {
+       if (seg_start < endext) {
                uint64_t io_end;
 
-               if (seg_end > 0x100000000ULL)
-                       io_end = 0x100000000ULL;
+               if (seg_end > endext)
+                       io_end = endext;
                else
                        io_end = seg_end;
 



Home | Main Index | Thread Index | Old Index