From owner-svn-src-all@FreeBSD.ORG Mon Mar 28 06:35:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58F5D106564A; Mon, 28 Mar 2011 06:35:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E9868FC14; Mon, 28 Mar 2011 06:35:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2S6ZIQC083632; Mon, 28 Mar 2011 06:35:18 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2S6ZIev083629; Mon, 28 Mar 2011 06:35:18 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201103280635.p2S6ZIev083629@svn.freebsd.org> From: Alan Cox Date: Mon, 28 Mar 2011 06:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220090 - in head/sys: amd64/amd64 conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2011 06:35:18 -0000 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) }