summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2023-04-02 16:25:52 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2023-04-06 21:19:58 +0300
commit00df1fc0601e9710df05e306e20402baed3b341a (patch)
tree9bc22efdce98b60db6ea6d634f68ce5581741757
parent4e00c63897b8c1956d53cb38249a047d5386aadf (diff)
downloadserenity-00df1fc0601e9710df05e306e20402baed3b341a.zip
Kernel: Store FPU state when dispatching signal on aarch64
And make sure to also restore it in sys$sigreturn.
-rw-r--r--Kernel/Syscalls/sigaction.cpp2
-rw-r--r--Kernel/Thread.cpp2
2 files changed, 0 insertions, 4 deletions
diff --git a/Kernel/Syscalls/sigaction.cpp b/Kernel/Syscalls/sigaction.cpp
index 7071b92978..cd17407109 100644
--- a/Kernel/Syscalls/sigaction.cpp
+++ b/Kernel/Syscalls/sigaction.cpp
@@ -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.
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 38fde59613..e464028f43 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -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));