diff options
author | Masanori Ogino <masanori.ogino@gmail.com> | 2020-11-08 02:27:12 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-08 03:12:05 +0100 |
commit | 9dbc292eed8c9971f4b9e26b30d0e3d65ef9c629 (patch) | |
tree | 07ef1fcb2da234287cfb5c933928a4f4cc066f9b | |
parent | d0aee051a980557ded97d00e74446bddecf161cc (diff) | |
download | gnumach-9dbc292eed8c9971f4b9e26b30d0e3d65ef9c629.tar.gz gnumach-9dbc292eed8c9971f4b9e26b30d0e3d65ef9c629.tar.bz2 gnumach-9dbc292eed8c9971f4b9e26b30d0e3d65ef9c629.zip |
i386 pmap: Omit pmap workaround on i486 or later.
As described in XXX comments, the workaround for memory mapping is
implemented for 80386 and it is unnecessary on i486 or later. Thus, it
is safe to omit that if the kernel is built for the recent (1989~)
processors.
Fuhito Inagawa pointed out the problem to me.
* i386/i386/trap.c (kernel_trap): Disable the workaround when the kernel
is built for i[456]86.
* i386/intel/pmap.c (pmap_protect, pmap_enter): Ditto.
* i386/intel/read_fault.c: Define intel_read_fault if and only if it is
necessary.
-rw-r--r-- | i386/i386/trap.c | 10 | ||||
-rw-r--r-- | i386/intel/pmap.c | 8 | ||||
-rw-r--r-- | i386/intel/read_fault.c | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/i386/i386/trap.c b/i386/i386/trap.c index 51c0f0a5..cbf45914 100644 --- a/i386/i386/trap.c +++ b/i386/i386/trap.c @@ -234,7 +234,13 @@ dump_ss(regs); */ result = vm_fault(map, trunc_page((vm_offset_t)subcode), +#if !(__i486__ || __i586__ || __i686__) VM_PROT_READ|VM_PROT_WRITE, +#else + (code & T_PF_WRITE) + ? VM_PROT_READ|VM_PROT_WRITE + : VM_PROT_READ, +#endif FALSE, FALSE, (void (*)()) 0); @@ -250,6 +256,7 @@ dump_ss(regs); } else #endif /* MACH_KDB */ +#if !(__i486__ || __i586__ || __i686__) if ((code & T_PF_WRITE) == 0 && result == KERN_PROTECTION_FAILURE) { @@ -261,6 +268,9 @@ dump_ss(regs); result = intel_read_fault(map, trunc_page((vm_offset_t)subcode)); } +#else + ; +#endif if (result == KERN_SUCCESS) { /* diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 1d214401..347474a9 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -1879,17 +1879,17 @@ void pmap_protect( return; } +#if !(__i486__ || __i586__ || __i686__) /* * If write-protecting in the kernel pmap, * remove the mappings; the i386 ignores * the write-permission bit in kernel mode. - * - * XXX should be #if'd for i386 */ if (map == kernel_pmap) { pmap_remove(map, s, e); return; } +#endif SPLVM(spl); simple_lock(&map->lock); @@ -1981,14 +1981,13 @@ void pmap_enter( if (pmap == kernel_pmap && (v < kernel_virtual_start || v >= kernel_virtual_end)) panic("pmap_enter(%lx, %llx) falls in physical memory area!\n", v, (unsigned long long) pa); #endif +#if !(__i486__ || __i586__ || __i686__) if (pmap == kernel_pmap && (prot & VM_PROT_WRITE) == 0 && !wired /* hack for io_wire */ ) { /* * Because the 386 ignores write protection in kernel mode, * we cannot enter a read-only kernel mapping, and must * remove an existing mapping if changing it. - * - * XXX should be #if'd for i386 */ PMAP_READ_LOCK(pmap, spl); @@ -2005,6 +2004,7 @@ void pmap_enter( PMAP_READ_UNLOCK(pmap, spl); return; } +#endif /* * Must allocate a new pvlist entry while we're unlocked; diff --git a/i386/intel/read_fault.c b/i386/intel/read_fault.c index 4b1edce3..0b79e3d8 100644 --- a/i386/intel/read_fault.c +++ b/i386/intel/read_fault.c @@ -33,6 +33,7 @@ #include <kern/macros.h> +#if !(__i486__ || __i586__ || __i686__) /* * Expansion of vm_fault for read fault in kernel mode. * Must enter the mapping as writable, since the i386 @@ -174,3 +175,4 @@ intel_read_fault( return (KERN_SUCCESS); } +#endif |