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

Kernel: Share the "return to ring 0/3 from signal" trampolines globally.

Generate a special page containing the "return from signal" trampoline code
on startup and then route signalled threads to it. This avoids a page
allocation in every process that ever receives a signal.
This commit is contained in:
Andreas Kling 2019-07-19 17:01:16 +02:00
parent fdf931cfce
commit f8beb0f665
5 changed files with 36 additions and 21 deletions

View file

@ -26,6 +26,9 @@ class ProcessTracer;
timeval kgettimeofday();
void kgettimeofday(timeval&);
extern VirtualAddress g_return_to_ring3_from_signal_trampoline;
extern VirtualAddress g_return_to_ring0_from_signal_trampoline;
class Process : public InlineLinkedListNode<Process>
, public Weakable<Process> {
friend class InlineLinkedListNode<Process>;
@ -287,8 +290,6 @@ private:
int alloc_fd(int first_candidate_fd = 0);
void disown_all_shared_buffers();
void create_signal_trampolines_if_needed();
Thread* m_main_thread { nullptr };
RefPtr<PageDirectory> m_page_directory;
@ -332,9 +333,6 @@ private:
NonnullRefPtrVector<Region> m_regions;
VirtualAddress m_return_to_ring3_from_signal_trampoline;
VirtualAddress m_return_to_ring0_from_signal_trampoline;
pid_t m_ppid { 0 };
mode_t m_umask { 022 };