[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hurd-bug
Subject:    [PATCH 1/3] pmap: only map lower BIOS memory 1:1 when using Linux drivers
From:       Luca Dariz <luca () orpolo ! org>
Date:       2023-05-26 18:47:59
Message-ID: 20230526184801.753581-2-luca () orpolo ! org
[Download RAW message or body]

* 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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic