Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/amd64 On amd64 we try to guarantee that VA = ...



details:   https://anonhg.NetBSD.org/src/rev/67e04329a43e
branches:  trunk
changeset: 819537:67e04329a43e
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Dec 09 17:57:24 2016 +0000

description:
On amd64 we try to guarantee that VA = PA + KERNBASE in the bootstrap
memory. But we have a problem with the ISA I/O MEM, because its va is
located above the kernel and its pa below it, so it does not respect
the rule.

To compensate for that we make the map look like the ISA stuff is above
the kernel by applying an offset on the pa. The issue with this design is
that we systematically lose 96 pages of physical memory.

Fix this by applying the offset on the va instead. Now these 96 pages are
internalized into uvm, and the rule is respected until kern_end.

diffstat:

 sys/arch/amd64/amd64/locore.S  |  8 +++++---
 sys/arch/amd64/amd64/machdep.c |  6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r ce60ed684903 -r 67e04329a43e sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Fri Dec 09 17:18:35 2016 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Fri Dec 09 17:57:24 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.115 2016/12/06 15:05:07 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.116 2016/12/09 17:57:24 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -592,6 +592,8 @@
  *
  * (PROC0 STK + L4 + L3 + L2 + L1) is later referred to as BOOTSTRAP TABLES.
  *
+ * ISA I/O MEM has no physical page allocated here, just virtual addresses.
+ *
  * Important note: the kernel segments are properly 4k-aligned
  * (see kern.ldscript), so there's no need to enforce alignment.
  */
@@ -864,8 +866,8 @@
        movw    %ax,%gs
        movw    %ax,%fs
 
-       /* XXX merge these */
-       leaq    (TABLESIZE+IOM_SIZE)(%rsi),%rdi
+       /* The first physical page available. */
+       leaq    (TABLESIZE)(%rsi),%rdi
 
 #else  /* XEN */
        /* First, reset the PSL. */
diff -r ce60ed684903 -r 67e04329a43e sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Fri Dec 09 17:18:35 2016 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Fri Dec 09 17:57:24 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.234 2016/11/25 11:57:36 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.235 2016/12/09 17:57:24 maxv Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.234 2016/11/25 11:57:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.235 2016/12/09 17:57:24 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1608,7 +1608,7 @@
 #endif /* !XEN */
 
        /* End of the virtual space we have created so far. */
-       kern_end = KERNBASE + first_avail;
+       kern_end = (vaddr_t)atdevbase + IOM_SIZE;
 
 #ifndef XEN
        /* The area for the module map. */



Home | Main Index | Thread Index | Old Index