From 96b9a12bd20f300ee8fcf003538e8aa560536c2c Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 10 Sep 2001 04:28:58 +0000 Subject: Rip some well duplicated code out of cpu_wait() and cpu_exit() and move it to the MI area. KSE touched cpu_wait() which had the same change replicated five ways for each platform. Now it can just do it once. The only MD parts seemed to be dealing with fpu state cleanup and things like vm86 cleanup on x86. The rest was identical. XXX: ia64 and powerpc did not have cpu_throw(), so I've put a functional stub in place. Reviewed by: jake, tmm, dillon --- sys/vm/vm_extern.h | 3 ++- sys/vm/vm_glue.c | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'sys/vm') diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index 307192f..9ff0191 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -80,7 +80,8 @@ void vm_fault_copy_entry __P((vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t void vm_fault_unwire __P((vm_map_t, vm_offset_t, vm_offset_t)); int vm_fault_wire __P((vm_map_t, vm_offset_t, vm_offset_t)); int vm_fault_user_wire __P((vm_map_t, vm_offset_t, vm_offset_t)); -void vm_fork __P((struct proc *, struct proc *, int)); +void vm_forkproc __P((struct proc *, struct proc *, int)); +void vm_waitproc __P((struct proc *)); int vm_mmap __P((vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, void *, vm_ooffset_t)); vm_offset_t vm_page_alloc_contig __P((vm_offset_t, vm_offset_t, vm_offset_t, vm_offset_t)); void vm_set_page_size __P((void)); diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 8ac0dde..5638175 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -209,7 +209,7 @@ vsunlock(addr, len) * to user mode to avoid stack copying and relocation problems. */ void -vm_fork(p1, p2, flags) +vm_forkproc(p1, p2, flags) struct proc *p1, *p2; int flags; { @@ -286,6 +286,22 @@ vm_fork(p1, p2, flags) } /* + * Called after process has been wait(2)'ed apon and is being reaped. + * The idea is to reclaim resources that we could not reclaim while + * the process was still executing. + */ +void +vm_waitproc(p) + struct proc *p; +{ + + GIANT_REQUIRED; + cpu_wait(p); + pmap_dispose_proc(p); /* drop per-process resources */ + vmspace_free(p->p_vmspace); /* and clean-out the vmspace */ +} + +/* * Set default limits for VM system. * Called for proc 0, and then inherited by all others. * -- cgit v1.1