bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] pmap: only map lower BIOS memory 1:1 when using Linux driver


From: Luca Dariz
Subject: [PATCH 1/3] pmap: only map lower BIOS memory 1:1 when using Linux drivers
Date: Fri, 26 May 2023 20:47:59 +0200

* 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.
---
 i386/intel/pmap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

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
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]