/* * this gets called so that we can store lazy state into memory and copy the * current task into the new thread. */ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { int ret; *dst = *src; if (fpu_allocated(&src->thread.fpu)) { memset(&dst->thread.fpu, 0, sizeof(dst->thread.fpu)); ret = fpu_alloc(&dst->thread.fpu); if (ret) return ret; fpu_copy(dst, src); } return 0; }
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { int ret; *dst = *src; if (fpu_allocated((struct fpu *)&src->thread.xstate)) { memset(&dst->thread.xstate, 0, sizeof(dst->thread.xstate)); ret = fpu_alloc((struct fpu *)&dst->thread.xstate); if (ret) return ret; fpu_copy((struct fpu *)&dst->thread.xstate, (struct fpu *)&src->thread.xstate); } return 0; }
/* * this gets called so that we can store lazy state into memory and copy the * current task into the new thread. */ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { *dst = *src; dst->thread.fpu_counter = 0; dst->thread.fpu.has_fpu = 0; dst->thread.fpu.state = NULL; task_disable_lazy_fpu_restore(dst); if (tsk_used_math(src)) { int err = fpu_alloc(&dst->thread.fpu); if (err) return err; fpu_copy(dst, src); } return 0; }
/* * this gets called so that we can store lazy state into memory and copy the * current task into the new thread. */ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { *dst = *src; dst->thread.fpu_counter = 0; dst->thread.fpu.has_fpu = 0; dst->thread.fpu.last_cpu = ~0; dst->thread.fpu.state = NULL; if (tsk_used_math(src)) { int err = fpu_alloc(&dst->thread.fpu); if (err) return err; fpu_copy(dst, src); } return 0; }
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { int ret; *dst = *src; if (fpu_allocated(&src->thread.fpu)) { memset(&dst->thread.fpu, 0, sizeof(dst->thread.fpu)); ret = fpu_alloc(&dst->thread.fpu); if (ret) return ret; fpu_copy(&dst->thread.fpu, &src->thread.fpu); } #ifdef CONFIG_X86_EARLYMIC if (dst->thread.fpu.state) { /* * No need to set this flag ? it should be inherited from the * parent thread since the threadinfo is copied from the * parent in setup_thread_stack() */ set_stopped_child_used_math(dst); /* * Simulate FPU DNA * Undo the effects of unlazy_fpu in prepare_to_copy() */ preempt_disable(); clts(); #ifdef CONFIG_ML1OM __math_state_restore(); #else restore_mask_regs(); stts(); #endif preempt_enable(); } #endif return 0; }