summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-06-05 11:03:06 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-06-05 11:03:06 +0000
commita9373777186bac0acc8148d4108429a9fc82c3c7 (patch)
tree42ea358aca2501d0078055c9026a71cb55ab667c /sys/arch
parent7f0672f1404b8202f54f66098bec7fd4b3e6725b (diff)
Changes to exit handling.
cpu_exit no longer frees the vmspace and u-area. This is now handled by a separate kernel thread "reaper". This is to avoid sleeping locks in the critical path of cpu_exit where we're not allowed to sleep. From NetBSD
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/locore.s10
-rw-r--r--sys/arch/alpha/alpha/vm_machdep.c4
-rw-r--r--sys/arch/amiga/amiga/locore.s16
-rw-r--r--sys/arch/amiga/amiga/vm_machdep.c9
-rw-r--r--sys/arch/hp300/hp300/locore.s12
-rw-r--r--sys/arch/hp300/hp300/vm_machdep.c4
-rw-r--r--sys/arch/i386/i386/locore.s26
-rw-r--r--sys/arch/i386/i386/vm_machdep.c33
-rw-r--r--sys/arch/kbus/include/pmap.h3
-rw-r--r--sys/arch/kbus/kbus/locore.s8
-rw-r--r--sys/arch/kbus/kbus/vm_machdep.c4
-rw-r--r--sys/arch/mac68k/mac68k/locore.s12
-rw-r--r--sys/arch/mac68k/mac68k/vm_machdep.c3
-rw-r--r--sys/arch/mips/mips/vm_machdep.c6
-rw-r--r--sys/arch/mvme68k/mvme68k/locore.s12
-rw-r--r--sys/arch/mvme68k/mvme68k/vm_machdep.c4
-rw-r--r--sys/arch/mvme88k/mvme88k/vm_machdep.c7
-rw-r--r--sys/arch/pmax/pmax/vm_machdep.c4
-rw-r--r--sys/arch/powerpc/powerpc/locore.S14
-rw-r--r--sys/arch/powerpc/powerpc/vm_machdep.c9
-rw-r--r--sys/arch/sparc/include/cpu.h4
-rw-r--r--sys/arch/sparc/include/pmap.h4
-rw-r--r--sys/arch/sparc/sparc/locore.s16
-rw-r--r--sys/arch/sparc/sparc/vm_machdep.c19
-rw-r--r--sys/arch/sun3/sun3/locore.s12
-rw-r--r--sys/arch/sun3/sun3/vm_machdep.c4
-rw-r--r--sys/arch/vax/vax/subr.s6
27 files changed, 98 insertions, 167 deletions
diff --git a/sys/arch/alpha/alpha/locore.s b/sys/arch/alpha/alpha/locore.s
index 5567c507053..3ec60e37fec 100644
--- a/sys/arch/alpha/alpha/locore.s
+++ b/sys/arch/alpha/alpha/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.11 1999/11/13 21:33:44 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.12 2000/06/05 11:02:54 art Exp $ */
/* $NetBSD: locore.s,v 1.27 1996/12/03 19:54:16 cgd Exp $ */
/*
@@ -833,11 +833,9 @@ LEAF(switch_exit, 1)
* the saved regs.
*/
- /* blow away the old user struct */
- ldq a0, kernel_map
- ldq a1, P_ADDR(s2)
- ldiq a2, (UPAGES * NBPG)
- CALL(kmem_free)
+ /* Schedule the vmspace and stack to be freed. */
+ mov s2, a0
+ CALL(exit2)
/* and jump into the middle of cpu_switch. */
#ifdef NEW_PMAP
diff --git a/sys/arch/alpha/alpha/vm_machdep.c b/sys/arch/alpha/alpha/vm_machdep.c
index 9009bc0cbe2..fe182b2fe0e 100644
--- a/sys/arch/alpha/alpha/vm_machdep.c
+++ b/sys/arch/alpha/alpha/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.12 1999/09/14 11:41:18 kstailey Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.13 2000/06/05 11:02:55 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.21 1996/11/13 21:13:15 cgd Exp $ */
/*
@@ -116,8 +116,6 @@ cpu_exit(p)
if (p == fpcurproc)
fpcurproc = NULL;
- vmspace_free(p->p_vmspace);
-
(void) splhigh();
switch_exit(p);
/* NOTREACHED */
diff --git a/sys/arch/amiga/amiga/locore.s b/sys/arch/amiga/amiga/locore.s
index 5db4275ae7c..dd604cc4bb4 100644
--- a/sys/arch/amiga/amiga/locore.s
+++ b/sys/arch/amiga/amiga/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.28 2000/05/28 03:55:21 art Exp $ */
+/* $OpenBSD: locore.s,v 1.29 2000/06/05 11:02:55 art Exp $ */
/* $NetBSD: locore.s,v 1.89 1997/07/17 16:22:54 is Exp $ */
/*
@@ -1223,16 +1223,10 @@ ENTRY(switch_exit)
movl #nullpcb,_curpcb | save state into garbage pcb
lea tmpstk,sp | goto a tmp stack
- /* Free old process's user area. */
- movl #USPACE,sp@- | size of u-area
- movl a0@(P_ADDR),sp@- | address u-area of process
- movl _kernel_map,sp@- | map it was allocated in
-#if defined(UVM)
- jbsr _uvm_km_free | deallocate it
-#else
- jbsr _kmem_free | deallocate it
-#endif
- lea sp@(12),sp | pop args
+ /* Schedule the vmspace and stack to be freed. */
+ movl a0,sp@- | exit2(p)
+ jbsr _C_LABEL(exit2)
+ lea sp@(4),sp | pop args
jra _cpu_switch
diff --git a/sys/arch/amiga/amiga/vm_machdep.c b/sys/arch/amiga/amiga/vm_machdep.c
index c9d782fe27a..70490213a40 100644
--- a/sys/arch/amiga/amiga/vm_machdep.c
+++ b/sys/arch/amiga/amiga/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.13 2000/05/28 03:55:21 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.14 2000/06/05 11:02:56 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1997/05/19 10:14:50 veego Exp $ */
/*
@@ -151,12 +151,7 @@ void
cpu_exit(p)
struct proc *p;
{
-#if defined(UVM)
- uvmspace_free(p->p_vmspace);
-#else
- vmspace_free(p->p_vmspace);
-#endif
-
+
(void)splhigh();
#if defined(UVM)
uvmexp.swtch++;
diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s
index 77ecd302818..5e0e831126c 100644
--- a/sys/arch/hp300/hp300/locore.s
+++ b/sys/arch/hp300/hp300/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.21 1998/09/06 20:09:59 millert Exp $ */
+/* $OpenBSD: locore.s,v 1.22 2000/06/05 11:02:57 art Exp $ */
/* $NetBSD: locore.s,v 1.79 1997/09/12 08:41:55 mycroft Exp $ */
/*
@@ -1221,12 +1221,10 @@ ENTRY(switch_exit)
movl #_ASM_LABEL(nullpcb),_C_LABEL(curpcb)
lea _ASM_LABEL(tmpstk),sp | goto a tmp stack
- /* Free old process's resources. */
- movl #USPACE,sp@- | size of u-area
- movl a0@(P_ADDR),sp@- | address of process's u-area
- movl _C_LABEL(kernel_map),sp@- | map it was allocated in
- jbsr _C_LABEL(kmem_free) | deallocate it
- lea sp@(12),sp | pop args
+ /* Schedule the vmspace and stack to be freed. */
+ movl a0,sp@- | exit2(p)
+ jbsr _C_LABEL(exit2)
+ lea sp@(4),sp | pop args
jra _C_LABEL(cpu_switch)
diff --git a/sys/arch/hp300/hp300/vm_machdep.c b/sys/arch/hp300/hp300/vm_machdep.c
index 337b16b1743..32c00e44189 100644
--- a/sys/arch/hp300/hp300/vm_machdep.c
+++ b/sys/arch/hp300/hp300/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.14 1999/09/03 18:00:44 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.15 2000/06/05 11:02:57 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.37 1997/05/26 00:27:43 thorpej Exp $ */
/*
@@ -134,8 +134,6 @@ cpu_exit(p)
struct proc *p;
{
- vmspace_free(p->p_vmspace);
-
(void) splimp();
cnt.v_swtch++;
switch_exit(p);
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index 5600f8c33c3..05c0f3dc1c0 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.50 2000/05/01 00:43:41 mickey Exp $ */
+/* $OpenBSD: locore.s,v 1.51 2000/06/05 11:02:54 art Exp $ */
/* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */
/*-
@@ -1943,24 +1943,12 @@ ENTRY(switch_exit)
/* Interrupts are okay again. */
sti
- /* Thoroughly nuke the old process's resources. */
- pushl P_ADDR(%edi)
- call _tss_free
- pushl P_VMSPACE(%edi)
-#if defined(UVM)
- call _C_LABEL(uvmspace_free)
-#else
- call _vmspace_free
-#endif
- pushl $USPACE
- pushl P_ADDR(%edi)
- pushl _kernel_map
-#if defined(UVM)
- call _C_LABEL(uvm_km_free)
-#else
- call _kmem_free
-#endif
- addl $20,%esp
+ /*
+ * Schedule the dead process's vmspace and stack to be freed.
+ */
+ pushl %edi /* exit2(p) */
+ call _C_LABEL(exit2)
+ addl $4,%esp
/* Jump into cpu_switch() with the right state. */
movl %ebx,%esi
diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c
index 78c3e5fa531..5ba85422128 100644
--- a/sys/arch/i386/i386/vm_machdep.c
+++ b/sys/arch/i386/i386/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.17 1999/08/17 10:32:16 niklas Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.18 2000/06/05 11:02:54 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.61 1996/05/03 19:42:35 christos Exp $ */
/*-
@@ -206,29 +206,12 @@ void
cpu_exit(p)
register struct proc *p;
{
-#ifdef USER_LDT
- struct pcb *pcb;
-#endif
- struct vmspace *vm;
-
#if NNPX > 0
/* If we were using the FPU, forget about it. */
if (npxproc == p)
npxproc = 0;
#endif
-#ifdef USER_LDT
- pcb = &p->p_addr->u_pcb;
- if (pcb->pcb_flags & PCB_USER_LDT)
- i386_user_cleanup(pcb);
-#endif
-
- vm = p->p_vmspace;
-#if !defined(UVM)
- if (vm->vm_refcnt == 1)
- vm_map_remove(&vm->vm_map, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS);
-#endif
-
#if defined(UVM)
uvmexp.swtch++;
#else
@@ -237,6 +220,20 @@ cpu_exit(p)
switch_exit(p);
}
+void
+cpu_wait(p)
+ struct proc *p;
+{
+ struct pcb *pcb;
+
+ pcb = &p->p_addr->u_pcb;
+#ifdef USER_LDT
+ if (pcb->pcb_flags & PCB_USER_LDT)
+ i386_user_cleanup(pcb);
+#endif
+ tss_free(pcb);
+}
+
/*
* Dump the machine specific segment at the start of a core dump.
*/
diff --git a/sys/arch/kbus/include/pmap.h b/sys/arch/kbus/include/pmap.h
index 228516d859a..7f338b611d8 100644
--- a/sys/arch/kbus/include/pmap.h
+++ b/sys/arch/kbus/include/pmap.h
@@ -294,7 +294,8 @@ void pmap_bootstrap __P((vm_offset_t firstaddr));
void pmap_disp_va __P((pmap_t pmap, vm_offset_t va));
vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
struct user;
-void switchexit __P((vm_map_t, struct user *, int));
+struct proc;
+void switchexit __P((struct proc *));
#endif /* _KERNEL */
#endif /* !_LOCORE */
diff --git a/sys/arch/kbus/kbus/locore.s b/sys/arch/kbus/kbus/locore.s
index 7c63f5c7938..97945eab30c 100644
--- a/sys/arch/kbus/kbus/locore.s
+++ b/sys/arch/kbus/kbus/locore.s
@@ -3087,8 +3087,6 @@ ENTRY(write_user_windows)
*/
ENTRY(switchexit)
mov %o0, %g2 ! save the
- mov %o1, %g3 ! ... three parameters
- mov %o2, %g4 ! ... to kmem_free
/*
* Change pcb to idle u. area, i.e., set %sp to top of stack
@@ -3119,10 +3117,8 @@ ENTRY(switchexit)
SET_SP_REDZONE(%l6, %l5)
#endif
wr %g0, PSR_S|PSR_ET, %psr ! and then enable traps
- mov %g2, %o0 ! now ready to call kmem_free
- mov %g3, %o1
- call _kmem_free
- mov %g4, %o2
+ call _exit2
+ mov %g2, %o0
/*
* Now fall through to `the last switch'. %g6 was set to
diff --git a/sys/arch/kbus/kbus/vm_machdep.c b/sys/arch/kbus/kbus/vm_machdep.c
index 7c054c2029f..c80e06aa8d2 100644
--- a/sys/arch/kbus/kbus/vm_machdep.c
+++ b/sys/arch/kbus/kbus/vm_machdep.c
@@ -437,8 +437,8 @@ cpu_exit(p)
}
free((void *)fs, M_SUBPROC);
}
- vmspace_free(p->p_vmspace);
- switchexit(kernel_map, p->p_addr, USPACE);
+
+ switchexit(p);
/* NOTREACHED */
}
diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s
index efe1f0d149a..7e062a830b4 100644
--- a/sys/arch/mac68k/mac68k/locore.s
+++ b/sys/arch/mac68k/mac68k/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.22 1999/01/20 13:31:16 niklas Exp $ */
+/* $OpenBSD: locore.s,v 1.23 2000/06/05 11:02:59 art Exp $ */
/* $NetBSD: locore.s,v 1.74 1997/02/02 08:17:46 thorpej Exp $ */
/*
@@ -1232,12 +1232,10 @@ ENTRY(switch_exit)
movl #nullpcb,_curpcb | save state into garbage pcb
lea tmpstk,sp | goto a tmp stack
- /* Free old process's user area. */
- movl #USPACE,sp@- | size of u-area
- movl a0@(P_ADDR),sp@- | address of process's u-area
- movl _kernel_map,sp@- | map it was allocated in
- jbsr _kmem_free | deallocate it
- lea sp@(12),sp | pop args
+ /* Schedule the vmspace and stack to be freed. */
+ movl a0,sp@- | exit2(p)
+ jbsr _C_LABEL(exit2)
+ lea sp@(4),sp | pop args
jra _cpu_switch
diff --git a/sys/arch/mac68k/mac68k/vm_machdep.c b/sys/arch/mac68k/mac68k/vm_machdep.c
index 82e722ca7c5..e89a7fe0a9a 100644
--- a/sys/arch/mac68k/mac68k/vm_machdep.c
+++ b/sys/arch/mac68k/mac68k/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.15 1999/10/10 18:29:22 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.16 2000/06/05 11:03:00 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.21 1996/09/16 18:00:31 scottr Exp $ */
/*
@@ -153,7 +153,6 @@ volatile void
cpu_exit(p)
struct proc *p;
{
- vmspace_free(p->p_vmspace);
(void) splhigh();
cnt.v_swtch++;
diff --git a/sys/arch/mips/mips/vm_machdep.c b/sys/arch/mips/mips/vm_machdep.c
index 72c64feb844..281e0974a0d 100644
--- a/sys/arch/mips/mips/vm_machdep.c
+++ b/sys/arch/mips/mips/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.7 1999/09/03 18:01:18 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.8 2000/06/05 11:03:00 art Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
@@ -182,10 +182,8 @@ cpu_exit(p)
if (machFPCurProcPtr == p)
machFPCurProcPtr = (struct proc *)0;
- vmspace_free(p->p_vmspace);
-
(void) splhigh();
- kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
+ exit2(p); /* XXX - probably very wrong */
switch_exit();
/* NOTREACHED */
}
diff --git a/sys/arch/mvme68k/mvme68k/locore.s b/sys/arch/mvme68k/mvme68k/locore.s
index 9ec195e0c03..1cce4c1d1ea 100644
--- a/sys/arch/mvme68k/mvme68k/locore.s
+++ b/sys/arch/mvme68k/mvme68k/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.20 2000/01/06 03:21:43 smurph Exp $ */
+/* $OpenBSD: locore.s,v 1.21 2000/06/05 11:03:01 art Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -1316,12 +1316,10 @@ ENTRY(switch_exit)
movl #nullpcb,_curpcb | save state into garbage pcb
lea tmpstk,sp | goto a tmp stack
- /* Free old process's resources. */
- movl #USPACE,sp@- | size of u-area
- movl a0@(P_ADDR),sp@- | address of process's u-area
- movl _kernel_map,sp@- | map it was allocated in
- jbsr _kmem_free | deallocate it
- lea sp@(12),sp | pop args
+ /* Schedule the vmspace and stack to be freed. */
+ movl a0,sp@- | exit2(p)
+ jbsr _C_LABEL(exit2)
+ lea sp@(4),sp | pop args
jra _cpu_switch
diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c
index 1722b359ce4..1182ded6de2 100644
--- a/sys/arch/mvme68k/mvme68k/vm_machdep.c
+++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.14 1999/09/27 20:30:32 smurph Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.15 2000/06/05 11:03:02 art Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -130,8 +130,6 @@ cpu_exit(p)
struct proc *p;
{
- vmspace_free(p->p_vmspace);
-
(void) splimp();
cnt.v_swtch++;
switch_exit(p);
diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c
index c3b3d79cef1..35cc2e080ef 100644
--- a/sys/arch/mvme88k/mvme88k/vm_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.11 1999/09/27 19:13:24 smurph Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.12 2000/06/05 11:03:02 art Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -42,7 +42,7 @@
* from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$
* from: @(#)vm_machdep.c 7.10 (Berkeley) 5/7/91
* vm_machdep.c,v 1.3 1993/07/07 07:09:32 cgd Exp
- * $Id: vm_machdep.c,v 1.11 1999/09/27 19:13:24 smurph Exp $
+ * $Id: vm_machdep.c,v 1.12 2000/06/05 11:03:02 art Exp $
*/
#include <sys/param.h>
@@ -175,10 +175,9 @@ void
cpu_exit(struct proc *p)
{
extern volatile void switch_exit();
- vmspace_free(p->p_vmspace);
(void) splimp();
- kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
+ exit2(p); /* XXX - can't be right! */
switch_exit(p);
/* NOTREACHED */
}
diff --git a/sys/arch/pmax/pmax/vm_machdep.c b/sys/arch/pmax/pmax/vm_machdep.c
index f6d106324b0..3f376e84eba 100644
--- a/sys/arch/pmax/pmax/vm_machdep.c
+++ b/sys/arch/pmax/pmax/vm_machdep.c
@@ -186,10 +186,8 @@ void cpu_exit(p)
if (machFPCurProcPtr == p)
machFPCurProcPtr = (struct proc *)0;
- vmspace_free(p->p_vmspace);
-
(void) splhigh();
- kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
+ exit2(p); /* XXX - probably very wrong. */
switch_exit();
/* NOTREACHED */
}
diff --git a/sys/arch/powerpc/powerpc/locore.S b/sys/arch/powerpc/powerpc/locore.S
index 9283eeea4e9..2ee811ca8c9 100644
--- a/sys/arch/powerpc/powerpc/locore.S
+++ b/sys/arch/powerpc/powerpc/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.10 2000/03/31 04:11:02 rahnds Exp $ */
+/* $OpenBSD: locore.S,v 1.11 2000/06/05 11:03:03 art Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
@@ -194,12 +194,12 @@ _ENTRY(_C_LABEL(switchexit))
lis 7,_C_LABEL(curpcb)@ha
stw 6,_C_LABEL(curpcb)@l(7)
addi 1,6,USPACE-16 /* 16 bytes are reserved at stack top */
-/* Now free the old user structure (args are already in r3, r4, r5) */
-#ifdef UVM
- bl _C_LABEL(uvm_km_free)
-#else
- bl _C_LABEL(kmem_free)
-#endif
+ /*
+ * Schedule the vmspace and stack to be freed (the proc arg is
+ * already in r3).
+ */
+ bl _C_LABEL(exit2)
+
/* Fall through to cpu_switch to actually select another proc */
/*
diff --git a/sys/arch/powerpc/powerpc/vm_machdep.c b/sys/arch/powerpc/powerpc/vm_machdep.c
index 88133ac3ef0..df840c21577 100644
--- a/sys/arch/powerpc/powerpc/vm_machdep.c
+++ b/sys/arch/powerpc/powerpc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.11 2000/01/16 22:52:22 rahnds Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.12 2000/06/05 11:03:04 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */
/*
@@ -180,13 +180,8 @@ cpu_exit(p)
if (p == fpuproc) /* release the fpu */
fpuproc = 0;
-#ifdef UVM
- uvmspace_free(p->p_vmspace);
-#else
- vmspace_free(p->p_vmspace);
-#endif
(void)splhigh();
- switchexit(kernel_map, p->p_addr, USPACE);
+ switchexit(p);
}
/*
diff --git a/sys/arch/sparc/include/cpu.h b/sys/arch/sparc/include/cpu.h
index c510fb680d1..b0268a2c0ce 100644
--- a/sys/arch/sparc/include/cpu.h
+++ b/sys/arch/sparc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.9 2000/05/18 13:31:12 jason Exp $ */
+/* $OpenBSD: cpu.h,v 1.10 2000/06/05 11:02:52 art Exp $ */
/* $NetBSD: cpu.h,v 1.24 1997/03/15 22:25:15 pk Exp $ */
/*
@@ -75,7 +75,7 @@
*/
#define cpu_swapin(p) /* nothing */
#define cpu_swapout(p) /* nothing */
-#define cpu_wait(p) /* nothing */
+#define cpu_wait(p) /* nothing */
/*
* Arguments to hardclock, softclock and gatherstats encapsulate the
diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h
index 12cc90be105..ef9f26ee2cb 100644
--- a/sys/arch/sparc/include/pmap.h
+++ b/sys/arch/sparc/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.15 1999/12/09 21:35:28 art Exp $ */
+/* $OpenBSD: pmap.h,v 1.16 2000/06/05 11:02:52 art Exp $ */
/* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */
/*
@@ -310,7 +310,7 @@ void kvm_setcache __P((caddr_t, int, int));
#define kvm_recache(addr, npages) kvm_setcache(addr, npages, 1)
void pmap_cache_enable __P((void));
struct user;
-void switchexit __P((vm_map_t, struct user *, int));
+void switchexit __P((struct proc *));
int mmu_pagein __P((struct pmap *pm, vaddr_t, int));
void pmap_writetext __P((unsigned char *, int));
diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s
index f9f38a40298..49ca3f92005 100644
--- a/sys/arch/sparc/sparc/locore.s
+++ b/sys/arch/sparc/sparc/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.37 2000/02/27 05:25:01 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.38 2000/06/05 11:02:53 art Exp $ */
/* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */
/*
@@ -4317,9 +4317,7 @@ ENTRY(write_user_windows)
* and note that the `last loaded process' is nonexistent.
*/
ENTRY(switchexit)
- mov %o0, %g2 ! save the
- mov %o1, %g3 ! ... three parameters
- mov %o2, %g4 ! ... to kmem_free
+ mov %o0, %g2 ! save proc for exit2() call
/*
* Change pcb to idle u. area, i.e., set %sp to top of stack
@@ -4341,14 +4339,8 @@ ENTRY(switchexit)
SET_SP_REDZONE(%l6, %l5)
#endif
wr %g0, PSR_S|PSR_ET, %psr ! and then enable traps
- mov %g2, %o0 ! now ready to call kmem_free
- mov %g3, %o1
-#if defined(UVM)
- call _uvm_km_free
-#else
- call _kmem_free
-#endif
- mov %g4, %o2
+ call _exit2 ! exit2(p)
+ mov %g2, %o0
/*
* Now fall through to `the last switch'. %g6 was set to
diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c
index 5e3f1ddf892..4e311ed46ea 100644
--- a/sys/arch/sparc/sparc/vm_machdep.c
+++ b/sys/arch/sparc/sparc/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.19 2000/05/01 18:28:58 art Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.20 2000/06/05 11:02:53 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */
/*
@@ -521,10 +521,11 @@ cpu_set_kpc(p, pc, arg)
/*
* cpu_exit is called as the last action during exit.
- * We release the address space and machine-dependent resources,
- * including the memory for the user structure and kernel stack.
- * Since the latter is also the interrupt stack, we release it
- * from assembly code after switching to a temporary pcb+stack.
+ *
+ * We clean up a little and then call switchexit() with the old proc
+ * as an argument. switchexit() switches to the idle context, schedules
+ * the old vmspace and stack to be freed, then selects a new process to
+ * run.
*/
void
cpu_exit(p)
@@ -539,12 +540,8 @@ cpu_exit(p)
}
free((void *)fs, M_SUBPROC);
}
-#if defined(UVM)
- uvmspace_free(p->p_vmspace);
-#else
- vmspace_free(p->p_vmspace);
-#endif
- switchexit(kernel_map, p->p_addr, USPACE);
+
+ switchexit(p);
/* NOTREACHED */
}
diff --git a/sys/arch/sun3/sun3/locore.s b/sys/arch/sun3/sun3/locore.s
index cc72f3f04fe..13ae9b105e4 100644
--- a/sys/arch/sun3/sun3/locore.s
+++ b/sys/arch/sun3/sun3/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.18 1997/04/05 20:22:01 kstailey Exp $ */
+/* $OpenBSD: locore.s,v 1.19 2000/06/05 11:03:04 art Exp $ */
/* $NetBSD: locore.s,v 1.40 1996/11/06 20:19:54 cgd Exp $ */
/*
@@ -935,12 +935,10 @@ ENTRY(switch_exit)
lea tmpstk,sp | goto a tmp stack
movl a0,sp@- | pass proc ptr down
- /* Free old process's u-area. */
- movl #USPACE,sp@- | size of u-area
- movl a0@(P_ADDR),sp@- | address of process's u-area
- movl _kernel_map,sp@- | map it was allocated in
- jbsr _kmem_free | deallocate it
- lea sp@(12),sp | pop args
+ /* Schedule the vmspace and stack to be freed. */
+ movl a0,sp@- | exit2(p)
+ jbsr _C_LABEL(exit2)
+ lea sp@(4),sp | pop args
jra _cpu_switch
diff --git a/sys/arch/sun3/sun3/vm_machdep.c b/sys/arch/sun3/sun3/vm_machdep.c
index cff257308c3..280dcea9a76 100644
--- a/sys/arch/sun3/sun3/vm_machdep.c
+++ b/sys/arch/sun3/sun3/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.11 2000/03/02 23:02:15 todd Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.12 2000/06/05 11:03:04 art Exp $ */
/* $NetBSD: vm_machdep.c,v 1.35 1996/04/26 18:38:06 gwr Exp $ */
/*
@@ -198,8 +198,6 @@ cpu_exit(p)
struct proc *p;
{
- vmspace_free(p->p_vmspace);
-
(void) splimp();
cnt.v_swtch++;
switch_exit(p);
diff --git a/sys/arch/vax/vax/subr.s b/sys/arch/vax/vax/subr.s
index 53cbee8332f..ec82a52c642 100644
--- a/sys/arch/vax/vax/subr.s
+++ b/sys/arch/vax/vax/subr.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.s,v 1.7 2000/04/27 01:10:13 bjc Exp $ */
+/* $OpenBSD: subr.s,v 1.8 2000/06/05 11:03:05 art Exp $ */
/* $NetBSD: subr.s,v 1.32 1999/03/25 00:41:48 mrg Exp $ */
/*
@@ -301,8 +301,8 @@ ENTRY(cpu_exit,0)
mtpr $0x18,$PR_IPL # Block almost everything
addl3 $512,_scratch,sp # Change stack, and schedule it to be freed
- pushl P_VMSPACE(r6)
- calls $1,_uvmspace_free
+ pushl r6
+ calls $1,_exit2
clrl r0 # No process to switch from
bicl3 $0xc0000000,_scratch,r1