diff options
| author | Alan Cox <alc@FreeBSD.org> | 2003-06-14 06:20:25 +0000 |
|---|---|---|
| committer | Alan Cox <alc@FreeBSD.org> | 2003-06-14 06:20:25 +0000 |
| commit | 89f4fca26524640a836b48761f0f131097bb43fe (patch) | |
| tree | dd61e4c6e73f5c138ec859061b2bcca151d658da | |
| parent | 5c784c8f4b7f19422d04565915b27ff9b1ffa07e (diff) | |
Notes
| -rw-r--r-- | sys/alpha/alpha/pmap.c | 29 | ||||
| -rw-r--r-- | sys/amd64/amd64/pmap.c | 30 | ||||
| -rw-r--r-- | sys/i386/i386/pmap.c | 30 | ||||
| -rw-r--r-- | sys/ia64/ia64/pmap.c | 26 | ||||
| -rw-r--r-- | sys/kern/kern_fork.c | 2 | ||||
| -rw-r--r-- | sys/kern/kern_proc.c | 2 | ||||
| -rw-r--r-- | sys/powerpc/aim/mmu_oea.c | 25 | ||||
| -rw-r--r-- | sys/powerpc/powerpc/mmu_oea.c | 25 | ||||
| -rw-r--r-- | sys/powerpc/powerpc/pmap.c | 25 | ||||
| -rw-r--r-- | sys/sparc64/sparc64/pmap.c | 28 | ||||
| -rw-r--r-- | sys/vm/pmap.h | 2 | ||||
| -rw-r--r-- | sys/vm/vm_extern.h | 2 | ||||
| -rw-r--r-- | sys/vm/vm_glue.c | 31 |
13 files changed, 35 insertions, 222 deletions
diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 94cf81b74fe3..082388591b5a 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -1064,35 +1064,6 @@ pmap_dispose_thread(td) } /* - * Set up a variable sized alternate kstack. - */ -void -pmap_new_altkstack(struct thread *td, int pages) -{ - /* shuffle the original stack */ - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack = td->td_kstack; - td->td_altkstack_pages = td->td_kstack_pages; - - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(td) - struct thread *td; -{ - pmap_dispose_thread(td); - - /* restore the original kstack */ - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -/* * Allow the kernel stack for a thread to be prejudicially paged out. */ void diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d3cdb59f8934..38a5f5b36582 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -997,36 +997,6 @@ pmap_dispose_thread(td) } /* - * Set up a variable sized alternate kstack. Though it may look MI, it may - * need to be different on certain arches like ia64. - */ -void -pmap_new_altkstack(struct thread *td, int pages) -{ - /* shuffle the original stack */ - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack = td->td_kstack; - td->td_altkstack_pages = td->td_kstack_pages; - - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(td) - struct thread *td; -{ - pmap_dispose_thread(td); - - /* restore the original kstack */ - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -/* * Allow the Kernel stack for a thread to be prejudicially paged out. */ void diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index c91357077530..c9a910ea67a8 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -1100,36 +1100,6 @@ pmap_dispose_thread(td) } /* - * Set up a variable sized alternate kstack. Though it may look MI, it may - * need to be different on certain arches like ia64. - */ -void -pmap_new_altkstack(struct thread *td, int pages) -{ - /* shuffle the original stack */ - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack = td->td_kstack; - td->td_altkstack_pages = td->td_kstack_pages; - - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(td) - struct thread *td; -{ - pmap_dispose_thread(td); - - /* restore the original kstack */ - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -/* * Allow the Kernel stack for a thread to be prejudicially paged out. */ void diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index 2e9d472d9ed8..dd6ba1df2f7c 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -797,32 +797,6 @@ pmap_dispose_thread(struct thread *td) } /* - * Set up a variable sized alternate kstack. This appears to be MI. - */ -void -pmap_new_altkstack(struct thread *td, int pages) -{ - - td->td_altkstack = td->td_kstack; - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack_pages = td->td_kstack_pages; - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(struct thread *td) -{ - - pmap_dispose_thread(td); - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -/* * Allow the KSTACK for a thread to be prejudicially paged out. */ void diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index e9e38ab3025f..4c514dfadc77 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -460,7 +460,7 @@ again: /* Allocate and switch to an alternate kstack if specified */ if (pages != 0) - pmap_new_altkstack(td2, pages); + vm_thread_new_altkstack(td2, pages); PROC_LOCK(p2); PROC_LOCK(p1); diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 548f0976fce3..c798b6828151 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -168,7 +168,7 @@ proc_dtor(void *mem, int size, void *arg) * freed, so you gotta do this here. */ if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0)) - pmap_dispose_altkstack(td); + vm_thread_dispose_altkstack(td); /* * We want to make sure we know the initial linkages. diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 00528814ac51..4808b4ddd8d9 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -1653,31 +1653,6 @@ pmap_dispose_thread(struct thread *td) } void -pmap_new_altkstack(struct thread *td, int pages) -{ - /* shuffle the original stack */ - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack = td->td_kstack; - td->td_altkstack_pages = td->td_kstack_pages; - - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(struct thread *td) -{ - pmap_dispose_thread(td); - - /* restore the original kstack */ - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -void pmap_swapin_thread(struct thread *td) { vm_page_t ma[KSTACK_MAX_PAGES]; diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index 00528814ac51..4808b4ddd8d9 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -1653,31 +1653,6 @@ pmap_dispose_thread(struct thread *td) } void -pmap_new_altkstack(struct thread *td, int pages) -{ - /* shuffle the original stack */ - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack = td->td_kstack; - td->td_altkstack_pages = td->td_kstack_pages; - - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(struct thread *td) -{ - pmap_dispose_thread(td); - - /* restore the original kstack */ - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -void pmap_swapin_thread(struct thread *td) { vm_page_t ma[KSTACK_MAX_PAGES]; diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index 00528814ac51..4808b4ddd8d9 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -1653,31 +1653,6 @@ pmap_dispose_thread(struct thread *td) } void -pmap_new_altkstack(struct thread *td, int pages) -{ - /* shuffle the original stack */ - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack = td->td_kstack; - td->td_altkstack_pages = td->td_kstack_pages; - - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(struct thread *td) -{ - pmap_dispose_thread(td); - - /* restore the original kstack */ - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -void pmap_swapin_thread(struct thread *td) { vm_page_t ma[KSTACK_MAX_PAGES]; diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index c58d4b4c6dac..4e3085911074 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -1031,34 +1031,6 @@ pmap_dispose_thread(struct thread *td) } /* - * Set up a variable sized alternate kstack. - */ -void -pmap_new_altkstack(struct thread *td, int pages) -{ - /* shuffle the original stack */ - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack = td->td_kstack; - td->td_altkstack_pages = td->td_kstack_pages; - - pmap_new_thread(td, pages); -} - -void -pmap_dispose_altkstack(struct thread *td) -{ - pmap_dispose_thread(td); - - /* restore the original kstack */ - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -/* * Allow the kernel stack for a thread to be prejudicially paged out. */ void diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h index 1a1e232059fe..36ca187387ff 100644 --- a/sys/vm/pmap.h +++ b/sys/vm/pmap.h @@ -131,8 +131,6 @@ void pmap_prefault(pmap_t, vm_offset_t, vm_map_entry_t); int pmap_mincore(pmap_t pmap, vm_offset_t addr); void pmap_new_thread(struct thread *td, int pages); void pmap_dispose_thread(struct thread *td); -void pmap_new_altkstack(struct thread *td, int pages); -void pmap_dispose_altkstack(struct thread *td); void pmap_swapout_thread(struct thread *td); void pmap_swapin_thread(struct thread *td); void pmap_activate(struct thread *td); diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index eafc30075e88..4718effac503 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -96,5 +96,7 @@ void vm_object_print(/* db_expr_t */ long, boolean_t, /* db_expr_t */ long, int vm_fault_quick(caddr_t v, int prot); void vm_proc_new(struct proc *p); void vm_proc_dispose(struct proc *p); +void vm_thread_new_altkstack(struct thread *td, int pages); +void vm_thread_dispose_altkstack(struct thread *td); #endif /* _KERNEL */ #endif /* !_VM_EXTERN_H_ */ diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index ec15d968cd08..2145c0c2f724 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -388,6 +388,37 @@ retry: #endif /* + * Set up a variable-sized alternate kstack. + */ +void +vm_thread_new_altkstack(struct thread *td, int pages) +{ + + td->td_altkstack = td->td_kstack; + td->td_altkstack_obj = td->td_kstack_obj; + td->td_altkstack_pages = td->td_kstack_pages; + + pmap_new_thread(td, pages); +} + +/* + * Restore the original kstack. + */ +void +vm_thread_dispose_altkstack(struct thread *td) +{ + + pmap_dispose_thread(td); + + td->td_kstack = td->td_altkstack; + td->td_kstack_obj = td->td_altkstack_obj; + td->td_kstack_pages = td->td_altkstack_pages; + td->td_altkstack = 0; + td->td_altkstack_obj = NULL; + td->td_altkstack_pages = 0; +} + +/* * Implement fork's actions on an address space. * Here we arrange for the address space to be copied or referenced, * allocate a user struct (pcb and kernel stack), then call the |
