summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/alpha/vm_machdep.c6
-rw-r--r--sys/i386/i386/vm_machdep.c6
-rw-r--r--sys/ia64/ia64/vm_machdep.c12
-rw-r--r--sys/kern/kern_kse.c3
-rw-r--r--sys/kern/kern_thr.c3
-rw-r--r--sys/kern/kern_thread.c3
-rw-r--r--sys/powerpc/aim/vm_machdep.c2
-rw-r--r--sys/powerpc/powerpc/vm_machdep.c2
-rw-r--r--sys/sparc64/sparc64/vm_machdep.c4
-rw-r--r--sys/sys/proc.h2
10 files changed, 21 insertions, 22 deletions
diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c
index a843cba..bdc8f5f 100644
--- a/sys/alpha/alpha/vm_machdep.c
+++ b/sys/alpha/alpha/vm_machdep.c
@@ -262,7 +262,7 @@ cpu_thread_setup(struct thread *td)
}
void
-cpu_set_upcall(struct thread *td, void *pcb)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
struct pcb *pcb2;
@@ -282,7 +282,7 @@ cpu_set_upcall(struct thread *td, void *pcb)
* at this time (see the matching comment below for
* more analysis) (need a good safe default).
*/
- bcopy(pcb, pcb2, sizeof(*pcb2));
+ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
/*
* Create a new fresh stack for the new thread.
@@ -291,7 +291,7 @@ cpu_set_upcall(struct thread *td, void *pcb)
* The contexts are filled in at the time we actually DO the
* upcall as only then do we know which KSE we got.
*/
- td->td_frame = (struct trapframe *)((caddr_t)pcb2) - 1;
+ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
/*
* Arrange for continuation at fork_return(), which
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index b3c3656..3cb48a1 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -320,7 +320,7 @@ cpu_thread_setup(struct thread *td)
* such as those generated in thread_userret() itself.
*/
void
-cpu_set_upcall(struct thread *td, void *pcb)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
struct pcb *pcb2;
@@ -338,7 +338,7 @@ cpu_set_upcall(struct thread *td, void *pcb)
* at this time (see the matching comment below for
* more analysis) (need a good safe default).
*/
- bcopy(pcb, pcb2, sizeof(*pcb2));
+ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
/*
* Create a new fresh stack for the new thread.
@@ -348,7 +348,7 @@ cpu_set_upcall(struct thread *td, void *pcb)
* The contexts are filled in at the time we actually DO the
* upcall as only then do we know which KSE we got.
*/
- td->td_frame = (struct trapframe *)((caddr_t)pcb2 - 16) - 1;
+ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
/*
* Set registers for trampoline to user mode. Leave space for the
diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c
index 246adeb..7603afb 100644
--- a/sys/ia64/ia64/vm_machdep.c
+++ b/sys/ia64/ia64/vm_machdep.c
@@ -120,24 +120,24 @@ cpu_thread_setup(struct thread *td)
}
void
-cpu_set_upcall(struct thread *td, void *pcb0)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
struct pcb *pcb;
struct trapframe *tf;
- pcb = td->td_pcb;
- KASSERT(pcb != NULL, ("foo"));
- bcopy(pcb0, pcb, sizeof(*pcb));
-
tf = td->td_frame;
KASSERT(tf != NULL, ("foo"));
+ bcopy(td0->td_frame, tf, sizeof(*tf));
+ tf->tf_length = sizeof(struct trapframe);
tf->tf_flags = FRAME_SYSCALL;
-
tf->tf_special.ndirty = 0;
tf->tf_scratch.gr8 = 0;
tf->tf_scratch.gr9 = 1;
tf->tf_scratch.gr10 = 0;
+ pcb = td->td_pcb;
+ KASSERT(pcb != NULL, ("foo"));
+ bcopy(td0->td_pcb, pcb, sizeof(*pcb));
pcb->pcb_special.bspstore = td->td_kstack;
pcb->pcb_special.pfs = 0;
pcb->pcb_current_pmap = vmspace_pmap(td->td_proc->p_vmspace);
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;
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
index 61e7ba0..b12db5b 100644
--- a/sys/powerpc/aim/vm_machdep.c
+++ b/sys/powerpc/aim/vm_machdep.c
@@ -278,7 +278,7 @@ cpu_thread_setup(struct thread *td)
}
void
-cpu_set_upcall(struct thread *td, void *pcb)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
return;
diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c
index 61e7ba0..b12db5b 100644
--- a/sys/powerpc/powerpc/vm_machdep.c
+++ b/sys/powerpc/powerpc/vm_machdep.c
@@ -278,7 +278,7 @@ cpu_thread_setup(struct thread *td)
}
void
-cpu_set_upcall(struct thread *td, void *pcb)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
return;
diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c
index 6d45ae5..22f1af0 100644
--- a/sys/sparc64/sparc64/vm_machdep.c
+++ b/sys/sparc64/sparc64/vm_machdep.c
@@ -147,12 +147,14 @@ cpu_thread_setup(struct thread *td)
}
void
-cpu_set_upcall(struct thread *td, void *v)
+cpu_set_upcall(struct thread *td, struct thread *td0)
{
struct trapframe *tf;
struct frame *fr;
struct pcb *pcb;
+ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
+
pcb = td->td_pcb;
tf = td->td_frame;
fr = (struct frame *)tf - 1;
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 75cde85..125e690 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -885,7 +885,7 @@ void ksegrp_stash(struct ksegrp *kg);
struct kse *kse_alloc(void);
void kse_free(struct kse *ke);
void kse_stash(struct kse *ke);
-void cpu_set_upcall(struct thread *td, void *pcb);
+void cpu_set_upcall(struct thread *td, struct thread *td0);
void cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku);
void cpu_thread_clean(struct thread *);
void cpu_thread_exit(struct thread *);
OpenPOWER on IntegriCloud