Ejemplo n.º 1
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);
	}
	return 0;
}
Ejemplo n.º 2
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;
}