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
21dc64dc21
commit
1759d247d9
|
@ -183,12 +183,9 @@ namespace Kernel
|
||||||
// Signal mask is inherited
|
// Signal mask is inherited
|
||||||
|
|
||||||
// Setup stack for returning
|
// Setup stack for returning
|
||||||
uintptr_t offset = m_rsp % PAGE_SIZE;
|
ASSERT_EQ(m_rsp % PAGE_SIZE, 0u);
|
||||||
if (offset == 0)
|
PageTable::with_fast_page(process().page_table().physical_address_of(m_rsp - PAGE_SIZE), [&] {
|
||||||
offset = PAGE_SIZE;
|
uintptr_t rsp = PageTable::fast_page() + PAGE_SIZE;
|
||||||
ASSERT_GTE(offset, 4 * sizeof(uintptr_t));
|
|
||||||
PageTable::with_fast_page(process().page_table().physical_address_of((m_rsp - 4 * sizeof(uintptr_t)) & PAGE_ADDR_MASK), [&] {
|
|
||||||
uintptr_t rsp = PageTable::fast_page() + offset;
|
|
||||||
write_to_stack(rsp, nullptr); // alignment
|
write_to_stack(rsp, nullptr); // alignment
|
||||||
write_to_stack(rsp, this);
|
write_to_stack(rsp, this);
|
||||||
write_to_stack(rsp, &Thread::on_exit);
|
write_to_stack(rsp, &Thread::on_exit);
|
||||||
|
@ -216,12 +213,9 @@ namespace Kernel
|
||||||
m_signal_pending_mask = 0;
|
m_signal_pending_mask = 0;
|
||||||
m_signal_block_mask = ~0ull;
|
m_signal_block_mask = ~0ull;
|
||||||
|
|
||||||
uintptr_t offset = m_rsp % PAGE_SIZE;
|
ASSERT_EQ(m_rsp % PAGE_SIZE, 0u);
|
||||||
if (offset == 0)
|
PageTable::with_fast_page(process().page_table().physical_address_of(m_rsp - PAGE_SIZE), [&] {
|
||||||
offset = PAGE_SIZE;
|
uintptr_t rsp = PageTable::fast_page() + PAGE_SIZE;
|
||||||
ASSERT_GTE(offset, 4 * sizeof(uintptr_t));
|
|
||||||
PageTable::with_fast_page(process().page_table().physical_address_of((m_rsp - 4 * sizeof(uintptr_t)) & PAGE_ADDR_MASK), [&] {
|
|
||||||
uintptr_t rsp = PageTable::fast_page() + offset;
|
|
||||||
write_to_stack(rsp, nullptr); // alignment
|
write_to_stack(rsp, nullptr); // alignment
|
||||||
write_to_stack(rsp, this);
|
write_to_stack(rsp, this);
|
||||||
write_to_stack(rsp, &Thread::on_exit);
|
write_to_stack(rsp, &Thread::on_exit);
|
||||||
|
|
Loading…
Reference in New Issue