Module Name:    src
Committed By:   snj
Date:           Wed Jun 21 17:41:50 UTC 2017

Modified Files:
        src/sys/arch/amd64/conf [netbsd-8]: kern.ldscript
        src/sys/arch/x86/x86 [netbsd-8]: x86_machdep.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.6.1 src/sys/arch/amd64/conf/kern.ldscript
cvs rdiff -u -r1.91 -r1.91.4.1 src/sys/arch/x86/x86/x86_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/amd64/conf/kern.ldscript
diff -u src/sys/arch/amd64/conf/kern.ldscript:1.22 src/sys/arch/amd64/conf/kern.ldscript:1.22.6.1
--- src/sys/arch/amd64/conf/kern.ldscript:1.22	Sat Feb 11 16:02:11 2017
+++ src/sys/arch/amd64/conf/kern.ldscript	Wed Jun 21 17:41:50 2017
@@ -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 @@ SECTIONS
 		*(.bss)
 		*(.bss.*)
 		*(COMMON)
-		. = ALIGN(64 / 8);
+		. = ALIGN(__LARGE_PAGE_SIZE);
 	}
 
-	. = ALIGN(__LARGE_PAGE_SIZE);
+	. = ALIGN(__PAGE_SIZE);
 
 	/* End of the kernel image */
 	__kernel_end = . ;

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.91 src/sys/arch/x86/x86/x86_machdep.c:1.91.4.1
--- src/sys/arch/x86/x86/x86_machdep.c:1.91	Fri Apr 14 04:43:47 2017
+++ src/sys/arch/x86/x86/x86_machdep.c	Wed Jun 21 17:41:50 2017
@@ -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 @@ static int
 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 @@ x86_add_cluster(uint64_t seg_start, uint
 	}
 
 	/*
-	 * 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;
 

Reply via email to