From bf5f76d431cb9d693e3259042a2526316cc64891 Mon Sep 17 00:00:00 2001 From: davidxu Date: Tue, 8 Apr 2003 07:45:56 +0000 Subject: Inherit blocked thread's context for upcall thread. --- sys/kern/kern_thread.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'sys/kern/kern_thread.c') diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index d3ceb09..5ffa8f6 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1242,7 +1242,9 @@ thread_exit(void) PROC_UNLOCK(p); td->td_kse = NULL; td->td_state = TDS_INACTIVE; +#if 0 td->td_proc = NULL; +#endif td->td_ksegrp = NULL; td->td_last_kse = NULL; PCPU_SET(deadthread, td); @@ -1395,13 +1397,6 @@ thread_alloc_spare(struct thread *td, struct thread *spare) bzero(&spare->td_startzero, (unsigned)RANGEOF(struct thread, td_startzero, td_endzero)); spare->td_proc = td->td_proc; - /* Setup PCB and fork address */ - cpu_set_upcall(spare, td->td_pcb); - /* - * XXXKSE do we really need this? (default values for the - * frame). - */ - bcopy(td->td_frame, spare->td_frame, sizeof(struct trapframe)); spare->td_ucred = crhold(td->td_ucred); } @@ -1433,6 +1428,9 @@ thread_schedule_upcall(struct thread *td, struct kse_upcall *ku) bcopy(&td->td_startcopy, &td2->td_startcopy, (unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy)); thread_link(td2, ku->ku_ksegrp); + /* inherit blocked thread's context */ + bcopy(td->td_frame, td2->td_frame, sizeof(struct trapframe)); + cpu_set_upcall(td2, td->td_pcb); /* Let the new thread become owner of the upcall */ ku->ku_owner = td2; td2->td_upcall = ku; -- cgit v1.1