Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Mar 2011 06:35:18 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220090 - in head/sys: amd64/amd64 conf
Message-ID:  <201103280635.p2S6ZIev083629@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Mon Mar 28 06:35:17 2011
New Revision: 220090
URL: http://svn.freebsd.org/changeset/base/220090

Log:
  The new binutils has correctly redefined MAXPAGESIZE on amd64 as 0x200000
  instead of 0x100000.  As a side effect, an amd64 kernel now loads at
  physical address 0x200000 instead of 0x100000.  This is probably for the
  best because it avoids the use of a 2MB page mapping for the first 1MB of
  the kernel that also spans the fixed MTRRs.  However, getmemsize() still
  thinks that the kernel loads at 0x100000, and so the physical memory between
  0x100000 and 0x200000 is lost.  Fix this problem by replacing the hard-wired
  constant in getmemsize() by a symbol "kernphys" that is defined by the
  linker script.
  
  In collaboration with:	kib

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/conf/ldscript.amd64

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Mon Mar 28 04:29:50 2011	(r220089)
+++ head/sys/amd64/amd64/machdep.c	Mon Mar 28 06:35:17 2011	(r220090)
@@ -156,6 +156,11 @@ static void get_fpcontext(struct thread 
 static int  set_fpcontext(struct thread *td, const mcontext_t *mcp);
 SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
 
+/*
+ * The file "conf/ldscript.amd64" defines the symbol "kernphys".  Its value is
+ * the physical address at which the kernel is loaded.
+ */
+extern char kernphys[];
 #ifdef DDB
 extern vm_offset_t ksym_start, ksym_end;
 #endif
@@ -1417,7 +1422,7 @@ getmemsize(caddr_t kmdp, u_int64_t first
 			/*
 			 * block out kernel memory as not available.
 			 */
-			if (pa >= 0x100000 && pa < first)
+			if (pa >= (vm_paddr_t)kernphys && pa < first)
 				goto do_dump_avail;
 
 			/*

Modified: head/sys/conf/ldscript.amd64
==============================================================================
--- head/sys/conf/ldscript.amd64	Mon Mar 28 04:29:50 2011	(r220089)
+++ head/sys/conf/ldscript.amd64	Mon Mar 28 06:35:17 2011	(r220090)
@@ -6,7 +6,8 @@ SEARCH_DIR("/usr/lib");
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
-  . = kernbase + CONSTANT (MAXPAGESIZE) + SIZEOF_HEADERS;
+  kernphys = CONSTANT (MAXPAGESIZE);
+  . = kernbase + kernphys + SIZEOF_HEADERS;
   .interp         : { *(.interp) }
   .hash           : { *(.hash) }
   .gnu.hash       : { *(.gnu.hash) }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103280635.p2S6ZIev083629>