Kernel: Simplify writing to threads stacks
This can be done more simply as all stacks are now page aligned
This commit is contained in:
parent
6d59a2b45d
commit
5c39903323
|
@ -179,14 +179,15 @@ namespace Kernel
|
||||||
// Signal mask is inherited
|
// Signal mask is inherited
|
||||||
|
|
||||||
// Setup stack for returning
|
// Setup stack for returning
|
||||||
{
|
ASSERT_EQ(m_rsp % PAGE_SIZE, 0u);
|
||||||
// FIXME: don't use PageTableScope
|
PageTable::with_fast_page(process().page_table().physical_address_of(m_rsp - PAGE_SIZE), [&] {
|
||||||
PageTableScope _(process().page_table());
|
uintptr_t rsp = PageTable::fast_page() + PAGE_SIZE;
|
||||||
write_to_stack(m_rsp, nullptr); // alignment
|
write_to_stack(rsp, nullptr); // alignment
|
||||||
write_to_stack(m_rsp, this);
|
write_to_stack(rsp, this);
|
||||||
write_to_stack(m_rsp, &Thread::on_exit);
|
write_to_stack(rsp, &Thread::on_exit);
|
||||||
write_to_stack(m_rsp, nullptr);
|
write_to_stack(rsp, nullptr);
|
||||||
}
|
m_rsp -= 4 * sizeof(uintptr_t);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::setup_process_cleanup()
|
void Thread::setup_process_cleanup()
|
||||||
|
@ -206,15 +207,15 @@ namespace Kernel
|
||||||
m_signal_pending_mask = 0;
|
m_signal_pending_mask = 0;
|
||||||
m_signal_block_mask = ~0ull;
|
m_signal_block_mask = ~0ull;
|
||||||
|
|
||||||
// Setup stack for returning
|
ASSERT_EQ(m_rsp % PAGE_SIZE, 0u);
|
||||||
{
|
PageTable::with_fast_page(process().page_table().physical_address_of(m_rsp - PAGE_SIZE), [&] {
|
||||||
// FIXME: don't use PageTableScope
|
uintptr_t rsp = PageTable::fast_page() + PAGE_SIZE;
|
||||||
PageTableScope _(process().page_table());
|
write_to_stack(rsp, nullptr); // alignment
|
||||||
write_to_stack(m_rsp, nullptr); // alignment
|
write_to_stack(rsp, this);
|
||||||
write_to_stack(m_rsp, this);
|
write_to_stack(rsp, &Thread::on_exit);
|
||||||
write_to_stack(m_rsp, &Thread::on_exit);
|
write_to_stack(rsp, m_process);
|
||||||
write_to_stack(m_rsp, m_process);
|
m_rsp -= 4 * sizeof(uintptr_t);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Thread::is_interrupted_by_signal()
|
bool Thread::is_interrupted_by_signal()
|
||||||
|
|
Loading…
Reference in New Issue