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

Kernel: Clean up thread stacks when a thread dies

We were forgetting where we put the userspace thread stacks, so added a
member called Thread::m_userspace_thread_stack to keep track of it.

Then, in ~Thread(), we now deallocate the userspace, kernel and signal
stacks (if present.)

Out of curiosity, the "init_stage2" process doesn't have a kernel stack
which I found surprising. :^)
This commit is contained in:
Andreas Kling 2019-08-01 20:17:12 +02:00
parent 3ad6ae1842
commit 5e01ebfc56
2 changed files with 13 additions and 3 deletions

View file

@ -326,6 +326,7 @@ private:
u32 m_pending_signals { 0 };
u32 m_signal_mask { 0 };
u32 m_kernel_stack_base { 0 };
RefPtr<Region> m_userspace_stack_region;
RefPtr<Region> m_kernel_stack_region;
RefPtr<Region> m_kernel_stack_for_signal_handler_region;
SignalActionData m_signal_action_data[32];