Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule the reaper to free them for us, once it is safe to do so (i.e. we are no longer running on the dead proc's vmspace and stack).
This commit is contained in:
parent
93ea1946f0
commit
8abe0d6b1c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.48 1998/05/19 18:35:11 thorpej Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.49 1998/09/09 00:07:48 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.48 1998/05/19 18:35:11 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.49 1998/09/09 00:07:48 thorpej Exp $");
|
||||
|
||||
#ifndef EVCNT_COUNTERS
|
||||
#include <machine/intrcnt.h>
|
||||
@ -800,9 +800,10 @@ LEAF(switch_trampoline, 0)
|
||||
|
||||
/*
|
||||
* switch_exit(struct proc *p)
|
||||
* Make a the named process exit. Partially switch to proc0, unmap
|
||||
* the old proc's user struct, and jump into the middle of cpu_switch
|
||||
* to switch into a few process. MUST BE CALLED AT SPLHIGH.
|
||||
* Make a the named process exit. Partially switch to proc0 (we don't
|
||||
* update curproc or restore registers), and jump into the middle of
|
||||
* cpu_switch to switch into a few process. The process reaper will
|
||||
* free the dead process's VM resources. MUST BE CALLED AT SPLHIGH.
|
||||
*/
|
||||
LEAF(switch_exit, 1)
|
||||
LDGP(pv)
|
||||
@ -825,15 +826,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)
|
||||
#if defined(UVM)
|
||||
CALL(uvm_km_free)
|
||||
#else
|
||||
CALL(kmem_free)
|
||||
#endif
|
||||
/* Schedule the vmspace and stack to be freed. */
|
||||
mov s2, a0
|
||||
CALL(exit2)
|
||||
|
||||
/*
|
||||
* Now jump back into the middle of cpu_switch(). Note that
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.37 1998/08/14 16:50:02 thorpej Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.38 1998/09/09 00:07:48 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.37 1998/08/14 16:50:02 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.38 1998/09/09 00:07:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -108,10 +108,9 @@ cpu_coredump(p, vp, cred, chdr)
|
||||
|
||||
/*
|
||||
* cpu_exit is called as the last action during exit.
|
||||
* We release the address space of the process, block interrupts,
|
||||
* and call switch_exit. switch_exit switches to proc0's PCB and stack,
|
||||
* then jumps into the middle of cpu_switch, as if it were switching
|
||||
* from proc0.
|
||||
* We block interrupts and call switch_exit. switch_exit switches
|
||||
* to proc0's PCB and stack, then jumps into the middle of cpu_switch,
|
||||
* as if it were switching from proc0.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
@ -129,12 +128,6 @@ cpu_exit(p)
|
||||
*/
|
||||
pmap_deactivate(p);
|
||||
|
||||
#if defined(UVM)
|
||||
uvmspace_free(p->p_vmspace);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
#endif
|
||||
|
||||
(void) splhigh();
|
||||
switch_exit(p);
|
||||
/* NOTREACHED */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.98 1998/07/10 20:24:05 mhitch Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.99 1998/09/09 00:07:49 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -1152,23 +1152,18 @@ pcbflag:
|
||||
|
||||
/*
|
||||
* At exit of a process, do a switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's user area.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0
|
||||
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 _C_LABEL(uvm_km_free) | deallocate it
|
||||
#else
|
||||
jbsr _C_LABEL(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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.37 1998/07/28 18:34:53 thorpej Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.38 1998/09/09 00:07:49 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -135,20 +135,14 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* cpu_exit is called as the last action during exit.
|
||||
* We release the address space and machine-dependent resources,
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* free our stack and user area and switch to another process
|
||||
* thus we never return.
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpuswitch.S,v 1.27 1998/08/16 02:17:17 mark Exp $ */
|
||||
/* $NetBSD: cpuswitch.S,v 1.28 1998/09/09 00:07:49 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||
@ -649,27 +649,10 @@ Lse_context_switched:
|
||||
str r3, [sp, #-0x0004]!
|
||||
|
||||
/*
|
||||
* Have to wait until we have switched to proc0 as the
|
||||
* pmap gets released in vmspace_free()
|
||||
* Schedule the vmspace and stack to be freed.
|
||||
*/
|
||||
ldr r0, [r3, #(P_VMSPACE)]
|
||||
#if defined(UVM)
|
||||
bl _uvmspace_free
|
||||
#else
|
||||
bl _vmspace_free
|
||||
#endif
|
||||
|
||||
/* This has to be done here */
|
||||
mov r2, #(UPAGES << PGSHIFT)
|
||||
ldr r0, [sp], #0x0004
|
||||
ldr r1, [r0, #(P_ADDR)]
|
||||
ldr r0, Lkernel_map
|
||||
ldr r0, [r0]
|
||||
#if defined(UVM)
|
||||
bl _uvm_km_free
|
||||
#else
|
||||
bl _kmem_free
|
||||
#endif
|
||||
mov r0, r3 /* exit2(p) */
|
||||
bl _exit2
|
||||
|
||||
/* Paranoia */
|
||||
mov r0, #0x00000000
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.29 1998/08/27 04:00:53 mark Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.30 1998/09/09 00:07:49 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||
@ -193,10 +193,8 @@ cpu_set_kpc(p, pc)
|
||||
* cpu_exit is called as the last action during exit.
|
||||
*
|
||||
* We clean up a little and then call switch_exit() with the old proc as an
|
||||
* argument. switch_exit() first switches to proc0's context, then does the
|
||||
* vmspace_free() and kmem_free() (or their UVM counterparts) that we don't
|
||||
* do here, and finally jumps into switch() to wait for another process
|
||||
* to wake up.
|
||||
* argument. switch_exit() first switches to proc0's context, and finally
|
||||
* jumps into switch() to wait for another process to wake up.
|
||||
*/
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.52 1998/07/04 22:18:21 jonathan Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.53 1998/09/09 00:07:50 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -1103,23 +1103,18 @@ pcbflag:
|
||||
|
||||
/*
|
||||
* At exit of a process, do a switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's user area.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0
|
||||
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
|
||||
#if defined(UVM)
|
||||
jbsr _C_LABEL(uvm_km_free) | deallocate it
|
||||
#else
|
||||
jbsr _C_LABEL(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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.18 1998/09/02 14:58:03 leo Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.19 1998/09/09 00:07:50 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -131,20 +131,14 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* cpu_exit is called as the last action during exit.
|
||||
* We release the address space and machine-dependent resources,
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* free our stack and user area and switch to another process
|
||||
* thus we never return.
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.7 1998/07/04 22:18:22 jonathan Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.8 1998/09/09 00:07:50 thorpej Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
|
||||
|
||||
/*
|
||||
@ -194,8 +194,7 @@ ASENTRY(Idle)
|
||||
b _ASM_LABEL(Idle)
|
||||
|
||||
/*
|
||||
* switchexit gets called from cpu_exit to free the user structure
|
||||
* and kernel stack of the current process.
|
||||
* switchexit gets called from cpu_exit to complete the exit procedure.
|
||||
*/
|
||||
ENTRY(switchexit)
|
||||
/* First switch to the idle pcb/kernel stack */
|
||||
@ -204,12 +203,12 @@ ENTRY(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) */
|
||||
#if defined(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 */
|
||||
li 3,0 /* indicate exited process */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.87 1998/07/04 22:18:23 jonathan Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.88 1998/09/09 00:07:51 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Gordon W. Ross
|
||||
@ -1195,7 +1195,8 @@ ASBSS(nullpcb,SIZEOF_PCB)
|
||||
|
||||
/*
|
||||
* At exit of a process, do a switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's resources.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0
|
||||
@ -1203,16 +1204,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
|
||||
#if defined(UVM)
|
||||
jbsr _C_LABEL(uvm_km_free) | deallocate it
|
||||
#else
|
||||
jbsr _C_LABEL(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 _C_LABEL(cpu_switch)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.42 1998/08/20 08:33:47 kleink Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.43 1998/09/09 00:07:51 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -116,24 +116,16 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* Once finished, we call switch_exit, which switches to a temporary
|
||||
* pcb and stack and never returns. We block memory allocation
|
||||
* until switch_exit has made things safe again.
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
#if defined(UVM)
|
||||
uvmspace_free(p->p_vmspace);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
#endif
|
||||
|
||||
(void) splimp();
|
||||
(void) splhigh();
|
||||
#if defined(UVM)
|
||||
uvmexp.swtch++;
|
||||
#else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.199 1998/08/15 05:10:23 mycroft Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.200 1998/09/09 00:07:52 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -2111,24 +2111,15 @@ ENTRY(switch_exit)
|
||||
/* Interrupts are okay again. */
|
||||
sti
|
||||
|
||||
/* Thoroughly nuke the old process's resources. */
|
||||
pushl P_ADDR(%edi)
|
||||
/*
|
||||
* Nuke the TSS and schedule the dead process's
|
||||
* vmspace and stack to be freed.
|
||||
*/
|
||||
pushl P_ADDR(%edi) /* tss_free(p->p_addr) */
|
||||
call _tss_free
|
||||
pushl P_VMSPACE(%edi)
|
||||
#if defined(UVM)
|
||||
call _uvmspace_free
|
||||
#else
|
||||
call _vmspace_free
|
||||
#endif
|
||||
pushl $USPACE
|
||||
pushl P_ADDR(%edi)
|
||||
pushl _kernel_map
|
||||
#if defined(UVM)
|
||||
call _uvm_km_free
|
||||
#else
|
||||
call _kmem_free
|
||||
#endif
|
||||
addl $20,%esp
|
||||
pushl %edi /* exit2(p) */
|
||||
call _exit2
|
||||
addl $8,%esp
|
||||
|
||||
/* Jump into cpu_switch() with the right state. */
|
||||
movl %ebx,%esi
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.71 1998/08/13 21:36:04 thorpej Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.72 1998/09/09 00:07:52 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
|
||||
@ -188,9 +188,8 @@ cpu_swapout(p)
|
||||
* cpu_exit is called as the last action during exit.
|
||||
*
|
||||
* We clean up a little and then call switch_exit() with the old proc as an
|
||||
* argument. switch_exit() first switches to proc0's context, then does the
|
||||
* vmspace_free() and uvm_km_free() that we don't do here, and finally jumps
|
||||
* into switch() to wait for another process to wake up.
|
||||
* argument. switch_exit() first switches to proc0's context, and finally
|
||||
* jumps into switch() to wait for another process to wake up.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.106 1998/08/16 22:29:03 scottr Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.107 1998/09/09 00:07:52 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -1029,7 +1029,8 @@ ASBSS(nullpcb,SIZEOF_PCB)
|
||||
|
||||
/*
|
||||
* At exit of a process, do a switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's resources.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0
|
||||
@ -1037,16 +1038,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
|
||||
#if defined(UVM)
|
||||
jbsr _C_LABEL(uvm_km_free) | deallocate it
|
||||
#else
|
||||
jbsr _C_LABEL(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 _C_LABEL(cpu_switch)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.29 1998/07/28 18:34:55 thorpej Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.30 1998/09/09 00:07:52 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -141,20 +141,14 @@ void switch_exit __P((struct proc *));
|
||||
|
||||
/*
|
||||
* cpu_exit is called as the last action during exit.
|
||||
* We release the address space and machine-dependent resources,
|
||||
* block context switches and then call switch_exit() which will
|
||||
* free our stack and user area and switch to another process.
|
||||
* Thus, we never return.
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
volatile void
|
||||
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)
|
||||
@ -163,7 +157,6 @@ cpu_exit(p)
|
||||
cnt.v_swtch++;
|
||||
#endif
|
||||
switch_exit(p);
|
||||
for(;;); /* Get rid of a compile warning */
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.S,v 1.5 1998/07/21 17:53:50 tsubai Exp $ */
|
||||
/* $NetBSD: locore.S,v 1.6 1998/09/09 00:07:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -278,8 +278,7 @@ ASENTRY(Idle)
|
||||
b _ASM_LABEL(Idle)
|
||||
|
||||
/*
|
||||
* switchexit gets called from cpu_exit to free the user structure
|
||||
* and kernel stack of the current process.
|
||||
* switchexit gets called from cpu_exit to complete the exit procedure.
|
||||
*/
|
||||
ENTRY(switchexit)
|
||||
/* First switch to the idle pcb/kernel stack */
|
||||
@ -288,12 +287,12 @@ ENTRY(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) */
|
||||
#if defined(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 */
|
||||
li 3,0 /* indicate exited process */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore_r2000.S,v 1.43 1998/03/12 05:45:05 thorpej Exp $ */
|
||||
/* $NetBSD: locore_r2000.S,v 1.44 1998/09/09 00:07:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -1617,9 +1617,9 @@ END(mips1_proc_trampoline)
|
||||
|
||||
/*
|
||||
* switch_exit(struct proc *)
|
||||
* Make the named process exit. Switch SP to nullproc stack, free the
|
||||
* exiting proc's USPACE, then jump into the middle of cpu_switch().
|
||||
* MUST BE CALLED AT SPLHIGH.
|
||||
* Make the named process exit. Switch SP to nullproc stack, schedule
|
||||
* the exiting proc's vmspace and stack to be freed, then jump into the
|
||||
* middle of cpu_switch(). MUST BE CALLED AT SPLHIGH.
|
||||
*/
|
||||
LEAF(mips1_switch_exit)
|
||||
la v1, _C_LABEL(nullproc) # !! SP runs on p->p_addr !!
|
||||
@ -1651,15 +1651,8 @@ LEAF(mips1_switch_exit)
|
||||
tlbwi # Write the TLB entry.
|
||||
|
||||
addu sp, v0, USPACE - START_FRAME
|
||||
li a2, USPACE
|
||||
lw a1, P_ADDR(a0)
|
||||
lw a0, kernel_map
|
||||
la ra, sw1 # goto cpu_switch()
|
||||
#if defined(UVM)
|
||||
j uvm_km_free # free exiting USPACE
|
||||
#else
|
||||
j kmem_free # free exiting USPACE
|
||||
#endif
|
||||
j exit2 # proc already in a0
|
||||
END(mips1_switch_exit)
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore_r4000.S,v 1.43 1998/04/19 01:48:34 jonathan Exp $ */
|
||||
/* $NetBSD: locore_r4000.S,v 1.44 1998/09/09 00:07:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
|
||||
@ -2113,9 +2113,9 @@ END(mips3_proc_trampoline)
|
||||
|
||||
/*
|
||||
* mips3_switch_exit(struct proc *)
|
||||
* Make the named process exit. Switch SP to nullproc stack, free the
|
||||
* exiting proc's USPACE, then jump into the middle of cpu_switch().
|
||||
* MUST BE CALLED AT SPLHIGH.
|
||||
* Make the named process exit. Switch SP to nullproc stack, schedule
|
||||
* the exiting proc's vmspace and stack to be freed, then jump into the
|
||||
* middle of cpu_switch(). MUST BE CALLED AT SPLHIGH.
|
||||
*/
|
||||
LEAF(mips3_switch_exit)
|
||||
la v1, _C_LABEL(nullproc) # !! SP runs on p->p_addr !!
|
||||
@ -2141,15 +2141,8 @@ LEAF(mips3_switch_exit)
|
||||
tlbwi # Write the TLB entry.
|
||||
|
||||
addu sp, v0, USPACE - START_FRAME
|
||||
li a2, USPACE
|
||||
lw a1, P_ADDR(a0)
|
||||
lw a0, kernel_map
|
||||
la ra, sw1 # goto cpu_switch()
|
||||
#if defined(UVM)
|
||||
j uvm_km_free # free exiting USPACE
|
||||
#else
|
||||
j kmem_free # free exiting USPACE
|
||||
#endif
|
||||
j exit2 # proc already in a0
|
||||
nop # XXX schedule better
|
||||
END(mips3_switch_exit)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.27 1998/09/02 06:41:22 nisimura Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.28 1998/09/09 00:07:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.27 1998/09/02 06:41:22 nisimura Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.28 1998/09/09 00:07:53 thorpej Exp $");
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
@ -145,10 +145,11 @@ cpu_swapin(p)
|
||||
|
||||
/*
|
||||
* cpu_exit is called as the last action during exit.
|
||||
* We release the address space of the process, block interrupts,
|
||||
* and call switch_exit. switch_exit switches to nullproc's PCB and stack,
|
||||
* then jumps into the middle of cpu_switch, as if it were switching
|
||||
* from nullproc.
|
||||
*
|
||||
* We clean up a little and then call switch_exit() with the old proc as an
|
||||
* argument. switch_exit() first switches to nullproc's PCB and stack,
|
||||
* schedules the dead proc's vmspace and stack to be freed, then jumps
|
||||
* into the middle of cpu_switch(), as if it were switching from nullproc.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
@ -158,12 +159,8 @@ cpu_exit(p)
|
||||
fpcurproc = (struct proc *)0;
|
||||
|
||||
#if defined(UVM)
|
||||
uvmspace_free(p->p_vmspace);
|
||||
|
||||
uvmexp.swtch++;
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
|
||||
cnt.v_swtch++;
|
||||
#endif
|
||||
(void)splhigh();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.38 1998/08/16 15:33:48 scw Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.39 1998/09/09 00:07:54 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -969,23 +969,18 @@ mdpflag:
|
||||
|
||||
/*
|
||||
* At exit of a process, do a switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's resources.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0
|
||||
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
|
||||
#ifdef 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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.15 1998/08/22 10:55:36 scw Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.16 1998/09/09 00:07:54 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -117,23 +117,15 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* Once finished, we call switch_exit, which switches to a temporary
|
||||
* pcb and stack and never returns. We block memory allocation
|
||||
* until switch_exit has made things safe again.
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
#ifdef UVM
|
||||
uvmspace_free(p->p_vmspace);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
#endif
|
||||
|
||||
(void) splhigh();
|
||||
#ifdef UVM
|
||||
uvmexp.swtch++;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.3 1998/08/28 22:47:12 dbj Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.4 1998/09/09 00:07:54 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Darrin B. Jewell
|
||||
@ -1113,7 +1113,8 @@ ASBSS(nullpcb,SIZEOF_PCB)
|
||||
|
||||
/*
|
||||
* At exit of a process, do a switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's resources.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0
|
||||
@ -1121,12 +1122,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)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.3 1998/08/28 23:05:55 dbj Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.4 1998/09/09 00:07:54 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* This file was taken from from mvme68k/mvme68k/vm_machdep.c
|
||||
@ -126,23 +126,15 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* Once finished, we call switch_exit, which switches to a temporary
|
||||
* pcb and stack and never returns. We block memory allocation
|
||||
* until switch_exit has made things safe again.
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
#ifdef UVM
|
||||
uvmspace_free(p->p_vmspace);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
#endif
|
||||
|
||||
(void) splhigh();
|
||||
#ifdef UVM
|
||||
uvmexp.swtch++;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.S,v 1.8 1998/07/04 22:18:34 jonathan Exp $ */
|
||||
/* $NetBSD: locore.S,v 1.9 1998/09/09 00:07:54 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -255,8 +255,7 @@ ASENTRY(Idle)
|
||||
b _ASM_LABEL(Idle)
|
||||
|
||||
/*
|
||||
* switchexit gets called from cpu_exit to free the user structure
|
||||
* and kernel stack of the current process.
|
||||
* switchexit gets called from cpu_exit to complete the exit procedure.
|
||||
*/
|
||||
ENTRY(switchexit)
|
||||
/* First switch to the idle pcb/kernel stack */
|
||||
@ -265,12 +264,12 @@ ENTRY(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) */
|
||||
#if defined(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 */
|
||||
li 3,0 /* indicate exited process */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.27 1998/09/02 19:17:21 matthias Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.28 1998/09/09 00:07:54 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 Matthias Pfaller.
|
||||
@ -159,11 +159,9 @@ cpu_swapout(p)
|
||||
/*
|
||||
* cpu_exit is called as the last action during exit.
|
||||
*
|
||||
* We switch to a temorary stack and address space. Then we release
|
||||
* release the original address space and machine-dependent resources,
|
||||
* including the memory for the user structure and kernel stack.
|
||||
* Once finished, we call cpu_exit, which never returns.
|
||||
* We block interrupts until cpu_switch has made things safe again.
|
||||
* We clean up a little and then call switch_exit() with the old proc as an
|
||||
* argument. switch_exit() first switches to proc0's context, and finally
|
||||
* jumps into switch() to wait for another process to wake up.
|
||||
*/
|
||||
void
|
||||
cpu_exit(arg)
|
||||
@ -188,16 +186,9 @@ cpu_exit(arg)
|
||||
lprd(sp, INTSTACK);
|
||||
load_ptb(proc0paddr->u_pcb.pcb_ptb);
|
||||
|
||||
/* Free resources. */
|
||||
#if defined(UVM)
|
||||
uvmspace_free(p->p_vmspace);
|
||||
/* Schedule the vmspace and stack to be freed. */
|
||||
(void) splhigh();
|
||||
uvm_km_free(kernel_map, (vaddr_t)p->p_addr, USPACE);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
(void) splhigh();
|
||||
kmem_free(kernel_map, (vaddr_t)p->p_addr, USPACE);
|
||||
#endif
|
||||
exit2(p);
|
||||
|
||||
/* Don't update pcb in cpu_switch. */
|
||||
curproc = NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.4 1998/08/31 14:43:41 tsubai Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.5 1998/09/09 00:07:55 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -154,12 +154,11 @@ pagemove(from, to, size)
|
||||
|
||||
/*
|
||||
* 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 we don't have curproc anymore, we cannot sleep, and therefor
|
||||
* this is at least incorrect for the multiprocessor version.
|
||||
* Not sure whether we can get away with this in the single proc version. XXX
|
||||
* 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)
|
||||
@ -168,12 +167,7 @@ cpu_exit(p)
|
||||
if (p == fpuproc) /* release the fpu */
|
||||
fpuproc = 0;
|
||||
|
||||
#if defined(UVM)
|
||||
uvmspace_free(p->p_vmspace);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
#endif
|
||||
switchexit(kernel_map, p->p_addr, USPACE);
|
||||
switchexit(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.h,v 1.34 1998/08/21 14:12:18 pk Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.35 1998/09/09 00:07:55 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -265,7 +265,7 @@ void pmap_virtual_space __P((vaddr_t *, vaddr_t *));
|
||||
void pmap_redzone __P((void));
|
||||
void kvm_uncache __P((caddr_t, int));
|
||||
struct user;
|
||||
void switchexit __P((vm_map_t, struct user *, int));
|
||||
void switchexit __P((struct proc *));
|
||||
int mmu_pagein __P((struct pmap *pm, int, int));
|
||||
void pmap_writetext __P((unsigned char *, int));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.87 1998/09/06 21:18:59 pk Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.88 1998/09/09 00:07:55 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Paul Kranenburg
|
||||
@ -4329,15 +4329,14 @@ ENTRY(write_user_windows)
|
||||
|
||||
/*
|
||||
* switchexit is called only from cpu_exit() before the current process
|
||||
* has freed its kernel stack; we must free it. (curproc is already NULL.)
|
||||
* has freed its vmspace and kernel stack; we must schedule them to be
|
||||
* freed. (curproc is already NULL.)
|
||||
*
|
||||
* We lay the process to rest by changing to the `idle' kernel stack,
|
||||
* 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
|
||||
@ -4359,14 +4358,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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.38 1998/08/21 14:13:56 pk Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.39 1998/09/09 00:07:55 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -312,10 +312,11 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* 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)
|
||||
@ -330,12 +331,7 @@ 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 */
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap.h,v 1.5 1998/08/30 15:32:17 eeh Exp $ */
|
||||
/* $NetBSD: pmap.h,v 1.6 1998/09/09 00:07:56 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -165,8 +165,8 @@ int pmap_dumpsize __P((void));
|
||||
int pmap_dumpmmu __P((int (*)__P((dev_t, daddr_t, caddr_t, size_t)),
|
||||
daddr_t));
|
||||
int pmap_pa_exists __P((paddr_t));
|
||||
struct user;
|
||||
void switchexit __P((vm_map_t, struct user *, int));
|
||||
struct proc;
|
||||
void switchexit __P((struct proc *));
|
||||
|
||||
/* SPARC64 specific */
|
||||
int ctx_alloc __P((struct pmap*));
|
||||
|
@ -6500,7 +6500,8 @@ _C_LABEL(masterpaddr):
|
||||
|
||||
/*
|
||||
* switchexit is called only from cpu_exit() before the current process
|
||||
* has freed its kernel stack; we must free it. (curproc is already NULL.)
|
||||
* has freed its vmspace and kernel stack; we must schedule them to be
|
||||
* freed. (curproc is already NULL.)
|
||||
*
|
||||
* We lay the process to rest by changing to the `idle' kernel stack,
|
||||
* and note that the `last loaded process' is nonexistent.
|
||||
@ -6513,9 +6514,7 @@ ENTRY(switchexit)
|
||||
restore
|
||||
#endif
|
||||
wrpr %g0, PSTATE_KERN, %pstate ! Make sure we're on the right globals
|
||||
mov %o0, %g2 ! save the
|
||||
mov %o1, %g3 ! ... three parameters
|
||||
mov %o2, %g4 ! ... to kmem_free
|
||||
mov %o0, %g2 ! save proc arg for exit2() call
|
||||
|
||||
#ifdef NOTDEF_DEBUG
|
||||
save %sp, -CC64FSZ, %sp
|
||||
@ -6573,14 +6572,8 @@ ENTRY(switchexit)
|
||||
SET_SP_REDZONE(%l6, %l5)
|
||||
#endif
|
||||
wrpr %g0, PSTATE_INTR, %pstate ! and then enable traps
|
||||
mov %g2, %o0 ! now ready to call kmem_free
|
||||
mov %g3, %o1
|
||||
#if defined(UVM)
|
||||
call _C_LABEL(uvm_km_free)
|
||||
#else
|
||||
call _C_LABEL(kmem_free)
|
||||
#endif
|
||||
mov %g4, %o2
|
||||
call _C_LABEL(exit2) ! exit2(p)
|
||||
mov %g2, %o0
|
||||
|
||||
/*
|
||||
* Now fall through to `the last switch'. %g6 was set to
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.8 1998/09/06 21:53:43 eeh Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.9 1998/09/09 00:07:56 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
@ -379,10 +379,11 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* 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)
|
||||
@ -397,12 +398,7 @@ 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 */
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.60 1998/06/08 20:47:46 gwr Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.61 1998/09/09 00:07:56 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Gordon W. Ross
|
||||
@ -630,26 +630,20 @@ ASBSS(nullpcb,SIZEOF_PCB)
|
||||
|
||||
/*
|
||||
* At exit of a process, do a cpu_switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's resources.
|
||||
* The ipl is high enough to prevent the memory from being reallocated.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0 | struct proc *p
|
||||
| save state into garbage pcb
|
||||
movl #_ASM_LABEL(nullpcb),_C_LABEL(curpcb)
|
||||
lea _ASM_LABEL(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 _C_LABEL(kernel_map),sp@- | map it was allocated in
|
||||
#if defined(UVM)
|
||||
jbsr _C_LABEL(uvm_km_free) | deallocate it
|
||||
#else
|
||||
jbsr _C_LABEL(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)
|
||||
|
||||
/* Don't pop the proc; pass it to cpu_switch(). */
|
||||
|
||||
jra _C_LABEL(cpu_switch)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.43 1998/07/28 18:34:58 thorpej Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.44 1998/09/09 00:07:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Gordon W. Ross
|
||||
@ -63,7 +63,6 @@
|
||||
/* XXX - Gratuitous name changes... */
|
||||
#define kmem_alloc_wait uvm_km_valloc_wait
|
||||
#define kmem_free_wakeup uvm_km_free_wakeup
|
||||
#define vmspace_free uvmspace_free
|
||||
#endif /* UVM */
|
||||
|
||||
#include <machine/cpu.h>
|
||||
@ -188,20 +187,16 @@ cpu_set_kpc(proc, func)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* Once finished, we call switch_exit, which switches to a temporary
|
||||
* pcb and stack and never returns. We block memory allocation
|
||||
* until switch_exit has made things safe again.
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
vmspace_free(p->p_vmspace);
|
||||
|
||||
(void) splimp();
|
||||
(void) splhigh();
|
||||
#if defined(UVM)
|
||||
uvmexp.swtch++;
|
||||
#else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.27 1998/06/09 20:47:17 gwr Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.28 1998/09/09 00:07:57 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -649,26 +649,20 @@ ASBSS(nullpcb,SIZEOF_PCB)
|
||||
|
||||
/*
|
||||
* At exit of a process, do a cpu_switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's resources.
|
||||
* The ipl is high enough to prevent the memory from being reallocated.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0 | struct proc *p
|
||||
| save state into garbage pcb
|
||||
movl #_ASM_LABEL(nullpcb),_C_LABEL(curpcb)
|
||||
lea _ASM_LABEL(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 _C_LABEL(kernel_map),sp@- | map it was allocated in
|
||||
#if defined(UVM)
|
||||
jbsr _C_LABEL(uvm_km_free) | deallocate it
|
||||
#else
|
||||
jbsr _C_LABEL(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)
|
||||
|
||||
/* Don't pop the proc; pass it to cpu_switch(). */
|
||||
|
||||
jra _C_LABEL(cpu_switch)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr.s,v 1.25 1998/07/04 22:18:45 jonathan Exp $ */
|
||||
/* $NetBSD: subr.s,v 1.26 1998/09/09 00:09:19 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
@ -265,23 +265,13 @@ noque: .asciz "swtch"
|
||||
#
|
||||
|
||||
ENTRY(cpu_exit,0)
|
||||
movl 4(ap),r6 # Process pointer in r0
|
||||
pushl P_VMSPACE(r6) # free current vm space
|
||||
#if defined(UVM)
|
||||
calls $1,_uvmspace_free
|
||||
#else
|
||||
calls $1,_vmspace_free
|
||||
#endif
|
||||
movl 4(ap),r6 # Process pointer in r6
|
||||
mtpr $0x18,$PR_IPL # Block almost everything
|
||||
addl3 $512,_scratch,sp # Change stack, we will free it now
|
||||
pushl $USPACE # stack size
|
||||
pushl P_ADDR(r6) # pointer to stack space
|
||||
pushl _kernel_map # the correct vm map
|
||||
#if defined(UVM)
|
||||
calls $3,_uvm_km_free
|
||||
#else
|
||||
calls $3,_kmem_free
|
||||
#endif
|
||||
addl3 $512,_scratch,sp # Change stack, and schedule it to be freed
|
||||
|
||||
pushl r6 # exit2(p)
|
||||
calls $1,_exit2
|
||||
|
||||
clrl r0 # No process to switch from
|
||||
bicl3 $0xc0000000,_scratch,r1
|
||||
mtpr r1,$PR_PCBB
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.32 1998/09/07 14:14:34 minoura Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.33 1998/09/09 00:09:19 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -1261,23 +1261,18 @@ mdpflag:
|
||||
|
||||
/*
|
||||
* At exit of a process, do a switch for the last time.
|
||||
* Switch to a safe stack and PCB, and deallocate the process's resources.
|
||||
* Switch to a safe stack and PCB, and select a new process to run. The
|
||||
* old stack and u-area will be freed by the reaper.
|
||||
*/
|
||||
ENTRY(switch_exit)
|
||||
movl sp@(4),a0
|
||||
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 _C_LABEL(kernel_map),sp@- | map it was allocated in
|
||||
#if defined(UVM)
|
||||
jbsr _C_LABEL(uvm_km_free) | deallocate it
|
||||
#else
|
||||
jbsr _C_LABEL(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 _C_LABEL(cpu_switch)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.12 1998/08/22 14:38:41 minoura Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.13 1998/09/09 00:09:19 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -116,24 +116,16 @@ cpu_set_kpc(p, pc)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* Once finished, we call switch_exit, which switches to a temporary
|
||||
* pcb and stack and never returns. We block memory allocation
|
||||
* until switch_exit has made things safe again.
|
||||
*
|
||||
* Block context switches and then call switch_exit() which will
|
||||
* switch to another process thus we never return.
|
||||
*/
|
||||
void
|
||||
cpu_exit(p)
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
#if defined(UVM)
|
||||
uvmspace_free(p->p_vmspace);
|
||||
#else
|
||||
vmspace_free(p->p_vmspace);
|
||||
#endif
|
||||
|
||||
(void) splimp();
|
||||
(void) splhigh();
|
||||
#if defined(UVM)
|
||||
uvmexp.swtch++;
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user