Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 Don't unmap page 0 when preparing to swap...



details:   https://anonhg.NetBSD.org/src/rev/a05858f5c6ff
branches:  trunk
changeset: 516191:a05858f5c6ff
user:      rearnsha <rearnsha%NetBSD.org@localhost>
date:      Thu Oct 18 09:26:08 2001 +0000

description:
Don't unmap page 0 when preparing to swap out a process.  If the pmap
is shared with another process (as can happen if vfork is being used),
then that other process will end up not having a page 0, which is bad
news indeed, since then there is no way back into the kernel.

Found this using a multi-ice box, so they are useful after all!

This seems to fix pr port-arm32/11921 and (possibly) kern/9859.

diffstat:

 sys/arch/arm/arm32/vm_machdep.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r 3219ff2f7f99 -r a05858f5c6ff sys/arch/arm/arm32/vm_machdep.c
--- a/sys/arch/arm/arm32/vm_machdep.c   Thu Oct 18 09:14:29 2001 +0000
+++ b/sys/arch/arm/arm32/vm_machdep.c   Thu Oct 18 09:26:08 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.7 2001/09/20 23:32:23 chris Exp $     */
+/*     $NetBSD: vm_machdep.c,v 1.8 2001/10/18 09:26:08 rearnsha Exp $  */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -226,7 +226,8 @@
 cpu_swapin(p)
        struct proc *p;
 {
-
+#if 0
+       /* Don't do this.  See the comment in cpu_swapout().  */
 #ifdef PMAP_DEBUG
        if (pmap_debug_level >= 0)
                printf("cpu_swapin(%p, %d, %s, %p)\n", p, p->p_pid,
@@ -237,6 +238,7 @@
        pmap_enter(p->p_vmspace->vm_map.pmap, 0x00000000, systempage.pv_pa,
            VM_PROT_READ, VM_PROT_READ|PMAP_WIRED);
        pmap_update(p->p_vmspace->vm_map.pmap);
+#endif
 }
 
 
@@ -244,7 +246,11 @@
 cpu_swapout(p)
        struct proc *p;
 {
-
+#if 0
+       /* 
+        * Don't do this!  If the pmap is shared with another process,
+        * it will loose it's page0 entry.  That's bad news indeed.
+        */
 #ifdef PMAP_DEBUG
        if (pmap_debug_level >= 0)
                printf("cpu_swapout(%p, %d, %s, %p)\n", p, p->p_pid,
@@ -254,6 +260,7 @@
        /* Free the system page mapping */
        pmap_remove(p->p_vmspace->vm_map.pmap, 0x00000000, 0x00000000 + NBPG);
        pmap_update(p->p_vmspace->vm_map.pmap);
+#endif
 }
 
 



Home | Main Index | Thread Index | Old Index