Kernel: Don't clone entire kernel stack on fork

We only need to copy area between [ret_sp, stack_end]. This range is
always very small compared to the whole stack (64 KiB).
This commit is contained in:
2026-04-04 23:26:39 +03:00
parent 9d83424346
commit 9fce114e8e
3 changed files with 26 additions and 41 deletions

View File

@@ -20,8 +20,6 @@ namespace Kernel
static BAN::ErrorOr<BAN::UniqPtr<VirtualRange>> create_to_vaddr_range(PageTable&, vaddr_t vaddr_start, vaddr_t vaddr_end, size_t, PageTable::flags_t flags, bool preallocate_pages, bool add_guard_pages);
~VirtualRange();
BAN::ErrorOr<BAN::UniqPtr<VirtualRange>> clone(PageTable&);
vaddr_t vaddr() const { return m_vaddr + (m_has_guard_pages ? PAGE_SIZE : 0); }
size_t size() const { return m_size - (m_has_guard_pages ? 2 * PAGE_SIZE : 0); }
PageTable::flags_t flags() const { return m_flags; }