1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

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
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));