Support eagerly FPU state save/restore

Co-authored-by: Shaowei Song <songshaowei.ssw@antgroup.com>
This commit is contained in:
Qingsong Chen
2024-11-28 11:36:09 +00:00
committed by Tate, Hongliang Tian
parent 69c1db772a
commit 5e35704e38
8 changed files with 279 additions and 104 deletions

View File

@ -414,7 +414,7 @@ fn clone_cpu_context(
tls: u64,
clone_flags: CloneFlags,
) -> UserContext {
let mut child_context = *parent_context;
let mut child_context = parent_context.clone();
// The return value of child thread is zero
child_context.set_syscall_ret(0);
@ -436,6 +436,10 @@ fn clone_cpu_context(
child_context.set_tls_pointer(tls as usize);
}
// New threads inherit the FPU state of the parent thread and
// the state is private to the thread thereafter.
child_context.fpu_state().save();
child_context
}