Move the *_new_altkstack() and *_dispose_altkstack() functions out of the
various pmap implementations into the machine-independent vm. They were all identical.
This commit is contained in:
parent
5c784c8f4b
commit
89f4fca265
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116328
@ -1063,35 +1063,6 @@ pmap_dispose_thread(td)
|
||||
vm_object_deallocate(ksobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
@ -996,36 +996,6 @@ pmap_dispose_thread(td)
|
||||
vm_object_deallocate(ksobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
@ -1099,36 +1099,6 @@ pmap_dispose_thread(td)
|
||||
vm_object_deallocate(ksobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
@ -796,32 +796,6 @@ pmap_dispose_thread(struct thread *td)
|
||||
td->td_kstack_pages = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
@ -460,7 +460,7 @@ fork1(td, flags, pages, procp)
|
||||
|
||||
/* 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);
|
||||
|
@ -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.
|
||||
|
@ -1652,31 +1652,6 @@ pmap_dispose_thread(struct thread *td)
|
||||
vm_object_deallocate(ksobj);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1652,31 +1652,6 @@ pmap_dispose_thread(struct thread *td)
|
||||
vm_object_deallocate(ksobj);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1652,31 +1652,6 @@ pmap_dispose_thread(struct thread *td)
|
||||
vm_object_deallocate(ksobj);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1030,34 +1030,6 @@ pmap_dispose_thread(struct thread *td)
|
||||
vm_object_deallocate(ksobj);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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_ */
|
||||
|
@ -387,6 +387,37 @@ vm_proc_swapin_all(int devidx)
|
||||
}
|
||||
#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,
|
||||
|
Loading…
Reference in New Issue
Block a user