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

UserspaceEmulator: Pass signal information through to emulated process

With this, SA_SIGINFO is also fully (as much as the kernel, at least)
supported by UE.
This commit is contained in:
Ali Mohammad Pur 2022-02-27 19:08:14 +03:30 committed by Andreas Kling
parent 1125cbe336
commit a5d4824abe
2 changed files with 76 additions and 55 deletions

View file

@ -92,7 +92,19 @@ public:
}
}
void did_receive_signal(int signum) { m_pending_signals |= (1 << signum); }
struct SignalInfo {
siginfo_t signal_info;
ucontext_t context;
};
void did_receive_signal(int signum, SignalInfo info, bool from_emulator = false)
{
if (!from_emulator && signum == SIGINT)
return did_receive_sigint(signum);
m_pending_signals |= (1 << signum);
m_signal_data[signum] = info;
}
void did_receive_sigint(int)
{
if (m_steps_til_pause == 0)
@ -126,6 +138,8 @@ private:
void register_signal_handlers();
void setup_signal_trampoline();
void send_signal(int);
void emit_profile_sample(AK::OutputStream&);
void emit_profile_event(AK::OutputStream&, StringView event_name, String const& contents);
@ -261,6 +275,7 @@ private:
sigset_t m_pending_signals { 0 };
sigset_t m_signal_mask { 0 };
Array<SignalInfo, NSIG> m_signal_data;
struct SignalHandlerInfo {
FlatPtr handler { 0 };