summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2023-05-26 20:47:59 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-26 23:38:53 +0200
commitd972c01c6cce5325732e9fec33b50685017d7e23 (patch)
tree6ea1896e9be49931ebbb45a8635b85c25ffbd7dd
parent377a9387cec7d4bdd6739d3bcc03f77f524adc69 (diff)
pmap: only map lower BIOS memory 1:1 when using Linux drivers
* i386/intel/pmap.c: add the check for LINUX_DEV; we could also check for !__x86_64__, as this config would break ther kernel map by removing the BIOS mem map, needed by the console and keyboard drivers, but hopefully we won't need to enable Linux drivers on x86_64. Message-Id: <20230526184801.753581-2-luca@orpolo.org>
-rw-r--r--i386/intel/pmap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 0305eb3f..0bb1a490 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -1326,6 +1326,7 @@ pmap_t pmap_create(vm_size_t size)
INTEL_PGBYTES);
}
+#ifdef LINUX_DEV
#if VM_MIN_KERNEL_ADDRESS != 0
/* Do not map BIOS in user tasks */
page_dir
@@ -1337,6 +1338,8 @@ pmap_t pmap_create(vm_size_t size)
[lin2pdenum(LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)]
= 0;
#endif
+#endif /* LINUX_DEV */
+
#ifdef MACH_PV_PAGETABLES
{
for (i = 0; i < PDPNUM; i++)
@@ -3120,11 +3123,14 @@ pmap_make_temporary_mapping(void)
kernel_page_dir[lin2pdenum_cont(INIT_VM_MIN_KERNEL_ADDRESS) + i] =
kernel_page_dir[lin2pdenum_cont(LINEAR_MIN_KERNEL_ADDRESS) + i];
#endif
+
+#ifdef LINUX_DEV
/* We need BIOS memory mapped at 0xc0000 & co for BIOS accesses */
#if VM_MIN_KERNEL_ADDRESS != 0
kernel_page_dir[lin2pdenum_cont(LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)] =
kernel_page_dir[lin2pdenum_cont(LINEAR_MIN_KERNEL_ADDRESS)];
#endif
+#endif /* LINUX_DEV */
#ifdef MACH_PV_PAGETABLES
#ifndef __x86_64__
@@ -3184,11 +3190,14 @@ pmap_remove_temporary_mapping(void)
#endif /* MACH_XEN */
}
#endif
+
+#ifdef LINUX_DEV
/* Keep BIOS memory mapped */
#if VM_MIN_KERNEL_ADDRESS != 0
kernel_page_dir[lin2pdenum_cont(LINEAR_MIN_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)] =
kernel_page_dir[lin2pdenum_cont(LINEAR_MIN_KERNEL_ADDRESS)];
#endif
+#endif /* LINUX_DEV */
/* Not used after boot, better give it back. */
#ifdef MACH_XEN