summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2010-11-26 19:36:26 +0000
committeralc <alc@FreeBSD.org>2010-11-26 19:36:26 +0000
commit754459840f135c55c128d215423864087090523d (patch)
tree0f8f199cf699cb1bab5eb8a9c608694b0004c429 /sys/amd64/include
parented99de310cdfe5c10e78419f94ca812947b1fe29 (diff)
downloadFreeBSD-src-754459840f135c55c128d215423864087090523d.zip
FreeBSD-src-754459840f135c55c128d215423864087090523d.tar.gz
Make the size of the direct map easily configurable. Changing NDMPML4E
now suffices. Increase the size of the direct map to 1TB. An earler version of this patch was tested by sbruno@.
Diffstat (limited to 'sys/amd64/include')
-rw-r--r--sys/amd64/include/pmap.h12
-rw-r--r--sys/amd64/include/vmparam.h7
2 files changed, 13 insertions, 6 deletions
diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index 45ccc64..c597cb2 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -125,15 +125,21 @@
#define NUPDPE (NUPML4E*NPDPEPG)/* number of userland PDP pages */
#define NUPDE (NUPDPE*NPDEPG) /* number of userland PD entries */
-#define NDMPML4E 1 /* number of dmap PML4 slots */
+/*
+ * NDMPML4E is the number of PML4 entries that are used to implement the
+ * direct map. It must be a power of two.
+ */
+#define NDMPML4E 2
/*
- * The *PDI values control the layout of virtual memory
+ * The *PDI values control the layout of virtual memory. The starting address
+ * of the direct map, which is controlled by DMPML4I, must be a multiple of
+ * its size. (See the PHYS_TO_DMAP() and DMAP_TO_PHYS() macros.)
*/
#define PML4PML4I (NPML4EPG/2) /* Index of recursive pml4 mapping */
#define KPML4I (NPML4EPG-1) /* Top 512GB for KVM */
-#define DMPML4I (KPML4I-1) /* Next 512GB down for direct map */
+#define DMPML4I rounddown(KPML4I - NDMPML4E, NDMPML4E) /* Below KVM */
#define KPDPI (NPDPEPG-2) /* kernbase at -2GB */
diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h
index dd0c0c9..7a50c59 100644
--- a/sys/amd64/include/vmparam.h
+++ b/sys/amd64/include/vmparam.h
@@ -163,8 +163,9 @@
* 0x0000000000000000 - 0x00007fffffffffff user map
* 0x0000800000000000 - 0xffff7fffffffffff does not exist (hole)
* 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot)
- * 0xffff804020101000 - 0xfffffeffffffffff unused
- * 0xffffff0000000000 - 0xffffff7fffffffff 512GB direct map mappings
+ * 0xffff804020101000 - 0xfffffdffffffffff unused
+ * 0xfffffe0000000000 - 0xfffffeffffffffff 1TB direct map
+ * 0xffffff0000000000 - 0xffffff7fffffffff unused
* 0xffffff8000000000 - 0xffffffffffffffff 512GB kernel map
*
* Within the kernel map:
@@ -176,7 +177,7 @@
#define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-512, 0, 0)
#define DMAP_MIN_ADDRESS KVADDR(DMPML4I, 0, 0, 0)
-#define DMAP_MAX_ADDRESS KVADDR(DMPML4I+1, 0, 0, 0)
+#define DMAP_MAX_ADDRESS KVADDR(DMPML4I + NDMPML4E, 0, 0, 0)
#define KERNBASE KVADDR(KPML4I, KPDPI, 0, 0)
OpenPOWER on IntegriCloud