mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Kernel: Allocate kernel signal stacks using the region allocator as well.
This commit is contained in:
parent
c8a216b107
commit
486c675850
Notes:
sideshowbarker
2024-07-19 14:09:13 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/486c6758503
3 changed files with 7 additions and 13 deletions
|
@ -362,8 +362,7 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
|
|||
entry_eip = loader.entry().get();
|
||||
}
|
||||
|
||||
kfree(current->m_kernel_stack_for_signal_handler);
|
||||
current->m_kernel_stack_for_signal_handler = nullptr;
|
||||
current->m_kernel_stack_for_signal_handler_region = nullptr;
|
||||
current->m_signal_stack_user_region = nullptr;
|
||||
current->set_default_signal_dispositions();
|
||||
current->m_signal_mask = 0;
|
||||
|
|
|
@ -79,11 +79,6 @@ Thread::~Thread()
|
|||
|
||||
if (selector())
|
||||
gdt_free_entry(selector());
|
||||
|
||||
if (m_kernel_stack_for_signal_handler) {
|
||||
kfree(m_kernel_stack_for_signal_handler);
|
||||
m_kernel_stack_for_signal_handler = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Thread::unblock()
|
||||
|
@ -360,14 +355,14 @@ ShouldUnblockThread Thread::dispatch_signal(byte signal)
|
|||
m_signal_stack_user_region = m_process.allocate_region(LinearAddress(), default_userspace_stack_size, "Signal stack (user)");
|
||||
ASSERT(m_signal_stack_user_region);
|
||||
}
|
||||
if (!m_kernel_stack_for_signal_handler) {
|
||||
m_kernel_stack_for_signal_handler = kmalloc(default_kernel_stack_size);
|
||||
ASSERT(m_kernel_stack_for_signal_handler);
|
||||
if (!m_kernel_stack_for_signal_handler_region) {
|
||||
m_kernel_stack_for_signal_handler_region = MM.allocate_kernel_region(default_kernel_stack_size, String::format("Kernel Stack (Thread %d)", m_tid));
|
||||
m_kernel_stack_for_signal_handler_region->commit();
|
||||
}
|
||||
m_tss.ss = 0x23;
|
||||
m_tss.esp = m_signal_stack_user_region->laddr().offset(default_userspace_stack_size).get();
|
||||
m_tss.ss0 = 0x10;
|
||||
m_tss.esp0 = (dword)m_kernel_stack_for_signal_handler + default_kernel_stack_size;
|
||||
m_tss.esp0 = m_kernel_stack_for_signal_handler_region->laddr().offset(default_kernel_stack_size).get();
|
||||
|
||||
push_value_on_stack(0);
|
||||
} else {
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
dword ticks_left() const { return m_ticks_left; }
|
||||
|
||||
dword kernel_stack_base() const { return m_kernel_stack_region->laddr().get(); }
|
||||
dword kernel_stack_for_signal_handler_base() const { return (dword)m_kernel_stack_for_signal_handler; }
|
||||
dword kernel_stack_for_signal_handler_base() const { return m_kernel_stack_for_signal_handler_region->laddr().get(); }
|
||||
|
||||
void set_selector(word s) { m_far_ptr.selector = s; }
|
||||
void set_state(State s) { m_state = s; }
|
||||
|
@ -146,7 +146,7 @@ private:
|
|||
dword m_pending_signals { 0 };
|
||||
dword m_signal_mask { 0 };
|
||||
RetainPtr<Region> m_kernel_stack_region;
|
||||
void* m_kernel_stack_for_signal_handler { nullptr };
|
||||
RetainPtr<Region> m_kernel_stack_for_signal_handler_region;
|
||||
pid_t m_waitee_pid { -1 };
|
||||
RetainPtr<FileDescriptor> m_blocked_descriptor;
|
||||
timeval m_select_timeout;
|
||||
|
|
Loading…
Reference in a new issue