summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-05-11 22:42:29 +0000
committerpeter <peter@FreeBSD.org>2003-05-11 22:42:29 +0000
commit89208473564a84d9f20a4be456ece60f3507cc4d (patch)
tree26b54f5810c57206249ecf0f59c3b3aa75a1fece /sys/boot
parentf6ba7180dc8070cd23b85334c05b82aabaab577e (diff)
downloadFreeBSD-src-89208473564a84d9f20a4be456ece60f3507cc4d.zip
FreeBSD-src-89208473564a84d9f20a4be456ece60f3507cc4d.tar.gz
For amd64 kernels, repeat the 1GB mapping over the entire address space
instead of just at 0GB and 1GB marks. This gives more flexibility for the choice of KERNBASE. Approved by: re (amd64 stuff)
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/i386/libi386/elf64_freebsd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/boot/i386/libi386/elf64_freebsd.c b/sys/boot/i386/libi386/elf64_freebsd.c
index d1033f2..ec9f929 100644
--- a/sys/boot/i386/libi386/elf64_freebsd.c
+++ b/sys/boot/i386/libi386/elf64_freebsd.c
@@ -86,20 +86,20 @@ elf64_exec(struct preloaded_file *fp)
bzero(PT3, PAGE_SIZE);
bzero(PT2, PAGE_SIZE);
- /* single PML4 entry */
- PT4[0] = (p4_entry_t)VTOP((uintptr_t)&PT3[0]);
- PT4[0] |= PG_V | PG_RW | PG_U;
-
- /* Direct map 1GB at address zero */
- PT3[0] = (p3_entry_t)VTOP((uintptr_t)&PT2[0]);
- PT3[0] |= PG_V | PG_RW | PG_U;
+ /*
+ * This is kinda brutal, but every single 1GB VM memory segment points to
+ * the same first 1GB of physical memory. But it is more than adequate.
+ */
+ for (i = 0; i < 512; i++) {
+ /* Each slot of the level 4 pages points to the same level 3 page */
+ PT4[i] = (p4_entry_t)VTOP((uintptr_t)&PT3[0]);
+ PT4[i] |= PG_V | PG_RW | PG_U;
- /* Direct map 1GB at KERNBASE (hardcoded for now) */
- PT3[1] = (p3_entry_t)VTOP((uintptr_t)&PT2[0]);
- PT3[1] |= PG_V | PG_RW | PG_U;
+ /* Each slot of the level 3 pages points to the same level 2 page */
+ PT3[i] = (p3_entry_t)VTOP((uintptr_t)&PT2[0]);
+ PT3[i] |= PG_V | PG_RW | PG_U;
- /* 512 PG_PS (2MB) page mappings for 1GB of direct mapping */
- for (i = 0; i < 512; i++) {
+ /* The level 2 page slots are mapped with 2MB pages for 1GB. */
PT2[i] = i * (2 * 1024 * 1024);
PT2[i] |= PG_V | PG_RW | PG_PS | PG_U;
}
OpenPOWER on IntegriCloud