summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-09-21 06:23:03 +0000
committerpeter <peter@FreeBSD.org>2001-09-21 06:23:03 +0000
commit7290545b37b990f88ce4868276e6341c59bf623d (patch)
tree54566470d8072fc43361997979af72c05e327e93 /sys
parent297dc90746f0278c0b594f39111f30765eaca913 (diff)
downloadFreeBSD-src-7290545b37b990f88ce4868276e6341c59bf623d.zip
FreeBSD-src-7290545b37b990f88ce4868276e6341c59bf623d.tar.gz
Introduce a new option, KVA_SPACE, which can be used to reconfigure
the size of the kernel virtual address space relatively painlessly. Userland will adapt via the exported kernbase symbol. Increasing this causes the user part of address space to reduce.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/pmap.h17
-rw-r--r--sys/conf/options.i3863
-rw-r--r--sys/conf/options.pc983
-rw-r--r--sys/i386/include/pmap.h17
4 files changed, 32 insertions, 8 deletions
diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index ab923fb..a6eabae 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -83,19 +83,28 @@
#define PGEX_U 0x04 /* access from User mode (UPL) */
/*
+ * Size of Kernel address space. This is the number of page table pages
+ * (4MB each) to use for the kernel. 256 pages == 1 Gigabyte.
+ * This **MUST** be a multiple of 4 (eg: 252, 256, 260, etc).
+ */
+#ifndef KVA_PAGES
+#define KVA_PAGES 256
+#endif
+
+/*
* Pte related macros
*/
#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT)))
#ifndef NKPT
-#define NKPT 30 /* actual number of kernel page tables */
+#define NKPT 30 /* actual number of kernel page tables */
#endif
#ifndef NKPDE
#ifdef SMP
-#define NKPDE 254 /* addressable number of page tables/pde's */
+#define NKPDE (KVA_PAGES - 2) /* addressable number of page tables/pde's */
#else
-#define NKPDE 255 /* addressable number of page tables/pde's */
-#endif /* SMP */
+#define NKPDE (KVA_PAGES - 1) /* addressable number of page tables/pde's */
+#endif
#endif
/*
diff --git a/sys/conf/options.i386 b/sys/conf/options.i386
index dc83994..34780d2 100644
--- a/sys/conf/options.i386
+++ b/sys/conf/options.i386
@@ -35,6 +35,9 @@ PECOFF_DEBUG opt_pecoff.h
# i386 SMP options
APIC_IO opt_global.h
+# Change KVM size. Changes things all over the kernel.
+KVA_PAGES opt_global.h
+
CLK_CALIBRATION_LOOP opt_clock.h
CLK_USE_I8254_CALIBRATION opt_clock.h
CLK_USE_TSC_CALIBRATION opt_clock.h
diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98
index 81b92fd..2716795 100644
--- a/sys/conf/options.pc98
+++ b/sys/conf/options.pc98
@@ -35,6 +35,9 @@ PECOFF_DEBUG opt_pecoff.h
# i386 SMP options
APIC_IO opt_global.h
+# Change KVM size. Changes things all over the kernel.
+KVA_PAGES opt_global.h
+
CLK_CALIBRATION_LOOP opt_clock.h
CLK_USE_I8254_CALIBRATION opt_clock.h
CLK_USE_TSC_CALIBRATION opt_clock.h
diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h
index ab923fb..a6eabae 100644
--- a/sys/i386/include/pmap.h
+++ b/sys/i386/include/pmap.h
@@ -83,19 +83,28 @@
#define PGEX_U 0x04 /* access from User mode (UPL) */
/*
+ * Size of Kernel address space. This is the number of page table pages
+ * (4MB each) to use for the kernel. 256 pages == 1 Gigabyte.
+ * This **MUST** be a multiple of 4 (eg: 252, 256, 260, etc).
+ */
+#ifndef KVA_PAGES
+#define KVA_PAGES 256
+#endif
+
+/*
* Pte related macros
*/
#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT)))
#ifndef NKPT
-#define NKPT 30 /* actual number of kernel page tables */
+#define NKPT 30 /* actual number of kernel page tables */
#endif
#ifndef NKPDE
#ifdef SMP
-#define NKPDE 254 /* addressable number of page tables/pde's */
+#define NKPDE (KVA_PAGES - 2) /* addressable number of page tables/pde's */
#else
-#define NKPDE 255 /* addressable number of page tables/pde's */
-#endif /* SMP */
+#define NKPDE (KVA_PAGES - 1) /* addressable number of page tables/pde's */
+#endif
#endif
/*
OpenPOWER on IntegriCloud