aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2011-03-28 06:35:17 +0000
committerAlan Cox <alc@FreeBSD.org>2011-03-28 06:35:17 +0000
commit1c675a3bc30cd3c5fb7973c8444ae662c52df4fe (patch)
tree3b272c999160ba635920218041fd00ed26c442df /sys/amd64
parente45dab861ea573e08b47a7a345c00aea9e3ab3e5 (diff)
downloadsrc-1c675a3bc30cd3c5fb7973c8444ae662c52df4fe.tar.gz
src-1c675a3bc30cd3c5fb7973c8444ae662c52df4fe.zip
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
Notes
Notes: svn path=/head/; revision=220090
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/machdep.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 3377376f158d..59a6ca8839f6 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -156,6 +156,11 @@ static void get_fpcontext(struct thread *td, mcontext_t *mcp);
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;
/*