diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-04-08 07:45:56 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-04-08 07:45:56 +0000 |
commit | bf5f76d431cb9d693e3259042a2526316cc64891 (patch) | |
tree | 52b2bdc59af0a3e83435a9c2f7927969fcafca1f | |
parent | bc776ad450a8c74f9c91d1012c0a938a06fa1e09 (diff) | |
download | FreeBSD-src-bf5f76d431cb9d693e3259042a2526316cc64891.zip FreeBSD-src-bf5f76d431cb9d693e3259042a2526316cc64891.tar.gz |
Inherit blocked thread's context for upcall thread.
-rw-r--r-- | sys/kern/kern_kse.c | 12 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 12 |
2 files changed, 10 insertions, 14 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index d3ceb09..5ffa8f6 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.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; 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; |