aboutsummaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-10 16:21:47 -0400
committerIan Moffett <ian@osmora.org>2024-07-10 16:21:47 -0400
commit7a915a81d23263df634a6ae626e0bc2f6f4b38b5 (patch)
tree36f3bc8b6e6d147ca32582f652b5cfae56d89e1e /sys/arch
parent3125adaf201fbd8436d63203ae6febc29b59b78f (diff)
kernel/amd64: bus: Fix memory mapping conflicts
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/bus_machdep.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/bus_machdep.c b/sys/arch/amd64/amd64/bus_machdep.c
index 5c0111d..3d4b302 100644
--- a/sys/arch/amd64/amd64/bus_machdep.c
+++ b/sys/arch/amd64/amd64/bus_machdep.c
@@ -36,6 +36,14 @@
#include <vm/pmap.h>
/*
+ * Hyra assumes that the bootloader uses PDE[256] for some
+ * higher half mappings. To avoid conflicts with those mappings,
+ * this offset is used to start device memory at PDE[257]. This
+ * will give us more than enough space.
+ */
+#define MMIO_OFFSET (VM_HIGHER_HALF + 0x8000000000)
+
+/*
* Map a physical device address into the kernel address
* space.
*
@@ -58,7 +66,7 @@ bus_map(bus_addr_t addr, size_t size, int flags, void **vap)
}
size = ALIGN_UP(size, DEFAULT_PAGESIZE);
- va = (vaddr_t)PHYS_TO_VIRT(addr);
+ va = addr + MMIO_OFFSET;
vas = pmap_read_vas();
/* Now map it to the higher half */