diff options
author | marcel <marcel@FreeBSD.org> | 2003-06-04 21:13:21 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-06-04 21:13:21 +0000 |
commit | 482a35058c1ec5165650b6b75eab0e46a3cafd33 (patch) | |
tree | 19ddbe55bfa5e54d0c6ec4f04832d6c8fdba3e5b /sys/kern | |
parent | 86cdf9a3b31bd723d7e54b2e6d59a8b626fca65b (diff) | |
download | FreeBSD-src-482a35058c1ec5165650b6b75eab0e46a3cafd33.zip FreeBSD-src-482a35058c1ec5165650b6b75eab0e46a3cafd33.tar.gz |
Change the second (and last) argument of cpu_set_upcall(). Previously
we were passing in a void* representing the PCB of the parent thread.
Now we pass a pointer to the parent thread itself.
The prime reason for this change is to allow cpu_set_upcall() to copy
(parts of) the trapframe instead of having it done in MI code in each
caller of cpu_set_upcall(). Copying the trapframe cannot always be
done with a simply bcopy() or may not always be optimal that way. On
ia64 specifically the trapframe contains information that is specific
to an entry into the kernel and can only be used by the corresponding
exit from the kernel. A trapframe copied verbatim from another frame
is in most cases useless without some additional normalization.
Note that this change removes the assignment to td->td_frame in some
implementations of cpu_set_upcall(). The assignment is redundant.
A previous call to cpu_thread_setup() already did the exact same
assignment. An added benefit of removing the redundant assignment is
that we can now change td_pcb without nasty side-effects.
This change officially marks the ability on ia64 for 1:1 threading.
Not tested on: amd64, powerpc
Compile & boot tested on: alpha, sparc64
Functionally tested on: i386, ia64
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_kse.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_thr.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 3 |
3 files changed, 3 insertions, 6 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index 33bf619..0dcadeb 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -1373,8 +1373,7 @@ thread_schedule_upcall(struct thread *td, struct kse_upcall *ku) (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); + cpu_set_upcall(td2, td); /* Let the new thread become owner of the upcall */ ku->ku_owner = td2; td2->td_upcall = ku; diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index a7be35f..dc991aa 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -156,7 +156,6 @@ thr_create(struct thread *td, struct thr_create_args *uap) PROC_LOCK(td->td_proc); td0->td_sigmask = td->td_sigmask; PROC_UNLOCK(td->td_proc); - bcopy(td->td_frame, td0->td_frame, sizeof(struct trapframe)); td0->td_ucred = crhold(td->td_ucred); /* Initialize our kse structure. */ @@ -165,7 +164,7 @@ thr_create(struct thread *td, struct thr_create_args *uap) RANGEOF(struct kse, ke_startzero, ke_endzero)); /* Set up our machine context. */ - cpu_set_upcall(td0, td->td_pcb); + cpu_set_upcall(td0, td); error = set_mcontext(td0, &ctx.uc_mcontext); if (error != 0) { kse_free(ke0); diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 33bf619..0dcadeb 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1373,8 +1373,7 @@ thread_schedule_upcall(struct thread *td, struct kse_upcall *ku) (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); + cpu_set_upcall(td2, td); /* Let the new thread become owner of the upcall */ ku->ku_owner = td2; td2->td_upcall = ku; |