diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -231,8 +231,6 @@ if (error) goto fail; - cpu_copy_thread(newtd, td); - bzero(&newtd->td_startzero, __rangeof(struct thread, td_startzero, td_endzero)); bcopy(&td->td_startcopy, &newtd->td_startcopy, @@ -241,6 +239,8 @@ newtd->td_rb_list = newtd->td_rbp_list = newtd->td_rb_inact = 0; thread_cow_get(newtd, td); + cpu_copy_thread(newtd, td); + error = initialize_thread(newtd, thunk); if (error != 0) { thread_cow_free(newtd);