o Rename cpu_thread_setup() to cpu_thread_alloc() to better

communicate that it relates to (is called by) thread_alloc()
o  Add cpu_thread_free() which is called from thread_free()
   to counter-act cpu_thread_alloc().

i386:	Have cpu_thread_free() call cpu_thread_clean() to
	preserve behaviour.
ia64:	Have cpu_thread_free() call mtx_destroy() for the
	mutex initialized in cpu_thread_alloc().

PR: ia64/118024
This commit is contained in:
Marcel Moolenaar 2007-11-14 20:21:54 +00:00
parent b5ad081c7c
commit 0c3967e7fe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173615
11 changed files with 58 additions and 13 deletions

View File

@ -240,7 +240,7 @@ cpu_thread_swapout(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
td->td_pcb = (struct pcb *)(td->td_kstack +
@ -248,6 +248,11 @@ cpu_thread_setup(struct thread *td)
td->td_frame = (struct trapframe *)td->td_pcb - 1;
}
void
cpu_thread_free(struct thread *td)
{
}
/*
* Initialize machine state (pcb and trap frame) for a new thread about to
* upcall. Put enough state in the new thread's PCB to get it to go back

View File

@ -333,7 +333,7 @@ cpu_thread_exit(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages *
PAGE_SIZE) - 1;
@ -344,8 +344,13 @@ cpu_thread_setup(struct thread *td)
pmap_use_minicache(td->td_kstack, td->td_kstack_pages * PAGE_SIZE);
#endif
#endif
}
void
cpu_thread_free(struct thread *td)
{
}
void
cpu_thread_clean(struct thread *td)
{

View File

@ -361,7 +361,7 @@ cpu_thread_swapout(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
td->td_pcb = (struct pcb *)(td->td_kstack +
@ -370,6 +370,13 @@ cpu_thread_setup(struct thread *td)
td->td_pcb->pcb_ext = NULL;
}
void
cpu_thread_free(struct thread *td)
{
cpu_thread_clean(td);
}
/*
* Initialize machine state (pcb and trap frame) for a new thread about to
* upcall. Put enough state in the new thread's PCB to get it to go back

View File

@ -806,7 +806,7 @@ ia64_init(void)
* and make proc0's trapframe pointer point to it for sanity.
* Initialise proc0's backing store to start after u area.
*/
cpu_thread_setup(&thread0);
cpu_thread_alloc(&thread0);
thread0.td_frame->tf_flags = FRAME_SYSCALL;
thread0.td_pcb->pcb_special.sp =
(u_int64_t)thread0.td_frame - 16;

View File

@ -107,7 +107,7 @@ cpu_thread_clean(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
intptr_t sp;
@ -120,6 +120,13 @@ cpu_thread_setup(struct thread *td)
mtx_init(&td->td_md.md_highfp_mtx, "High FP lock", NULL, MTX_SPIN);
}
void
cpu_thread_free(struct thread *td)
{
mtx_destroy(&td->td_md.md_highfp_mtx);
}
void
cpu_thread_swapin(struct thread *td)
{

View File

@ -325,7 +325,7 @@ thread_alloc(void)
uma_zfree(thread_zone, td);
return (NULL);
}
cpu_thread_setup(td);
cpu_thread_alloc(td);
return (td);
}
@ -337,7 +337,7 @@ void
thread_free(struct thread *td)
{
cpu_thread_clean(td);
cpu_thread_free(td);
if (td->td_altkstack != 0)
vm_thread_dispose_altkstack(td);
if (td->td_kstack != 0)

View File

@ -277,7 +277,7 @@ cpu_thread_clean(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
struct pcb *pcb;
@ -287,6 +287,11 @@ cpu_thread_setup(struct thread *td)
td->td_frame = (struct trapframe *)pcb - 1;
}
void
cpu_thread_free(struct thread *td)
{
}
void
cpu_thread_swapin(struct thread *td)
{

View File

@ -277,7 +277,7 @@ cpu_thread_clean(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
struct pcb *pcb;
@ -287,6 +287,11 @@ cpu_thread_setup(struct thread *td)
td->td_frame = (struct trapframe *)pcb - 1;
}
void
cpu_thread_free(struct thread *td)
{
}
void
cpu_thread_swapin(struct thread *td)
{

View File

@ -132,7 +132,7 @@ cpu_thread_clean(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
struct pcb *pcb;
@ -143,6 +143,11 @@ cpu_thread_setup(struct thread *td)
td->td_pcb = pcb;
}
void
cpu_thread_free(struct thread *td)
{
}
void
cpu_thread_swapin(struct thread *td)
{

View File

@ -111,7 +111,7 @@ cpu_thread_clean(struct thread *td)
}
void
cpu_thread_setup(struct thread *td)
cpu_thread_alloc(struct thread *td)
{
struct pcb *pcb;
@ -126,6 +126,11 @@ cpu_thread_setup(struct thread *td)
}
void
cpu_thread_free(struct thread *td)
{
}
void
cpu_thread_swapin(struct thread *td)
{

View File

@ -877,9 +877,10 @@ void upcall_remove(struct thread *td);
void cpu_set_upcall(struct thread *td, struct thread *td0);
void cpu_set_upcall_kse(struct thread *, void (*)(void *), void *, stack_t *);
int cpu_set_user_tls(struct thread *, void *tls_base);
void cpu_thread_alloc(struct thread *);
void cpu_thread_clean(struct thread *);
void cpu_thread_exit(struct thread *);
void cpu_thread_setup(struct thread *td);
void cpu_thread_free(struct thread *);
void cpu_thread_swapin(struct thread *);
void cpu_thread_swapout(struct thread *);
struct thread *thread_alloc(void);