1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:27:35 +00:00

Kernel: Move sys$sigaction() implementation inside ARCH(i386)

This commit is contained in:
Andreas Kling 2021-02-25 11:33:06 +01:00
parent 3c9cebea6e
commit c11511a0ab

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <Kernel/Panic.h>
#include <Kernel/Process.h>
namespace Kernel {
@ -87,11 +88,12 @@ int Process::sys$sigaction(int signum, const sigaction* act, sigaction* old_act)
return 0;
}
int Process::sys$sigreturn(RegisterState& registers)
int Process::sys$sigreturn([[maybe_unused]] RegisterState& registers)
{
REQUIRE_PROMISE(stdio);
SmapDisabler disabler;
#if ARCH(I386)
//Here, we restore the state pushed by dispatch signal and asm_signal_trampoline.
u32* stack_ptr = (u32*)registers.userspace_esp;
u32 smuggled_eax = *stack_ptr;
@ -114,6 +116,9 @@ int Process::sys$sigreturn(RegisterState& registers)
registers.userspace_esp = registers.esp;
return smuggled_eax;
#else
PANIC("sys$sigreturn() not implemented.");
#endif
}
}