summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux/linux_machdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/linux/linux_machdep.c')
-rw-r--r--sys/i386/linux/linux_machdep.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index 4bb457b..73fa345 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -414,24 +414,24 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
}
}
- if (args->flags & CLONE_PARENT) {
-#ifdef DEBUG
- printf("linux_clone: CLONE_PARENT\n");
-#endif
+ if (args->flags & (CLONE_PARENT|CLONE_THREAD)) {
+ sx_xlock(&proctree_lock);
+ PROC_LOCK(p2);
+ proc_reparent(p2, td->td_proc->p_pptr);
+ PROC_UNLOCK(p2);
+ sx_xunlock(&proctree_lock);
}
-
+
if (args->flags & CLONE_THREAD) {
/* XXX: linux mangles pgrp and pptr somehow
* I think it might be this but I am not sure.
*/
#ifdef notyet
+ PROC_LOCK(p2);
p2->p_pgrp = td->td_proc->p_pgrp;
- p2->p_pptr = td->td_proc->p_pptr;
+ PROC_UNLOCK(p2);
#endif
exit_signal = 0;
-#ifdef DEBUG
- printf("linux_clone: CLONE_THREADS\n");
-#endif
}
if (args->flags & CLONE_CHILD_SETTID)
@@ -443,6 +443,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
em->child_clear_tid = args->child_tidptr;
else
em->child_clear_tid = NULL;
+
EMUL_UNLOCK(&emul_lock);
PROC_LOCK(p2);
@@ -502,13 +503,9 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
sd.sd_gran);
#endif
- /* this is taken from i386 version of cpu_set_user_tls() */
- critical_enter();
/* set %gs */
td2->td_pcb->pcb_gsd = sd;
- PCPU_GET(fsgs_gdt)[1] = sd;
- load_gs(GSEL(GUGS_SEL, SEL_UPL));
- critical_exit();
+ td2->td_pcb->pcb_gs = GSEL(GUGS_SEL, SEL_UPL);
}
#ifdef DEBUG
OpenPOWER on IntegriCloud