mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 18:02:54 +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:
parent
4e00c63897
commit
00df1fc060
Notes:
sideshowbarker
2024-07-16 21:51:04 +09:00
Author: https://github.com/FireFox317
Commit: 00df1fc060
Pull-request: https://github.com/SerenityOS/serenity/pull/18149
Reviewed-by: https://github.com/IdanHo ✅
2 changed files with 0 additions and 4 deletions
|
@ -87,14 +87,12 @@ ErrorOr<FlatPtr> Process::sys$sigreturn(RegisterState& registers)
|
||||||
// Stack state (created by the signal trampoline):
|
// Stack state (created by the signal trampoline):
|
||||||
// saved_ax, ucontext, signal_info, fpu_state?.
|
// 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.
|
// 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.
|
// 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 {};
|
alignas(alignof(FPUState) * 2) FPUState data {};
|
||||||
TRY(copy_from_user(&data, bit_cast<FPUState const*>(stack_ptr)));
|
TRY(copy_from_user(&data, bit_cast<FPUState const*>(stack_ptr)));
|
||||||
Thread::current()->fpu_state() = data;
|
Thread::current()->fpu_state() = data;
|
||||||
stack_ptr += sizeof(FPUState);
|
stack_ptr += sizeof(FPUState);
|
||||||
#endif
|
|
||||||
|
|
||||||
stack_ptr += sizeof(siginfo); // We don't need this here.
|
stack_ptr += sizeof(siginfo); // We don't need this here.
|
||||||
|
|
||||||
|
|
|
@ -1150,10 +1150,8 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
|
||||||
|
|
||||||
VERIFY(stack % 16 == 0);
|
VERIFY(stack % 16 == 0);
|
||||||
|
|
||||||
#if ARCH(X86_64)
|
|
||||||
// Save the FPU/SSE state
|
// Save the FPU/SSE state
|
||||||
TRY(copy_value_on_user_stack(stack, fpu_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_ucontext));
|
||||||
TRY(push_value_on_user_stack(stack, pointer_to_signal_info));
|
TRY(push_value_on_user_stack(stack, pointer_to_signal_info));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue