Kernel: Save and restore FPU state on signal dispatch on i386/x86_64

This commit is contained in:
Ali Mohammad Pur 2022-02-26 18:30:51 +03:30 committed by Andreas Kling
parent e14e919b78
commit 88d7bf7362
Notes: sideshowbarker 2024-07-17 17:57:06 +09:00
3 changed files with 19 additions and 7 deletions

View file

@ -85,7 +85,14 @@ ErrorOr<FlatPtr> Process::sys$sigreturn([[maybe_unused]] RegisterState& register
auto stack_ptr = registers.userspace_sp();
// Stack state (created by the signal trampoline):
// saved_ax, ucontext, signal_info.
// saved_ax, ucontext, signal_info, fpu_state?.
#if ARCH(I386) || ARCH(X86_64)
// The FPU state is at the top here, pop it off and restore it.
Thread::current()->fpu_state() = TRY(copy_typed_from_user<FPUState>(stack_ptr));
stack_ptr += sizeof(FPUState);
#endif
stack_ptr += sizeof(siginfo); // We don't need this here.
auto ucontext = TRY(copy_typed_from_user<__ucontext>(stack_ptr));