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

Kernel: Store FPU state when dispatching signal on aarch64

And make sure to also restore it in sys$sigreturn.
This commit is contained in:
Timon Kruiper 2023-04-02 16:25:52 +02:00 committed by Idan Horowitz
parent 4e00c63897
commit 00df1fc060
2 changed files with 0 additions and 4 deletions

View file

@ -87,14 +87,12 @@ ErrorOr<FlatPtr> Process::sys$sigreturn(RegisterState& registers)
// Stack state (created by the signal trampoline):
// saved_ax, ucontext, signal_info, fpu_state?.
#if ARCH(X86_64)
// The FPU state is at the top here, pop it off and restore it.
// FIXME: The stack alignment is off by 8 bytes here, figure this out and remove this excessively aligned object.
alignas(alignof(FPUState) * 2) FPUState data {};
TRY(copy_from_user(&data, bit_cast<FPUState const*>(stack_ptr)));
Thread::current()->fpu_state() = data;
stack_ptr += sizeof(FPUState);
#endif
stack_ptr += sizeof(siginfo); // We don't need this here.

View file

@ -1150,10 +1150,8 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
VERIFY(stack % 16 == 0);
#if ARCH(X86_64)
// Save the FPU/SSE state
TRY(copy_value_on_user_stack(stack, fpu_state()));
#endif
TRY(push_value_on_user_stack(stack, pointer_to_ucontext));
TRY(push_value_on_user_stack(stack, pointer_to_signal_info));