From 72cdc62155be8af67ff9328bc4226a69bbbb659c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 5 Nov 2018 10:23:00 +0100 Subject: Replace zones with individually tracked physical pages. It's just a simple struct { ref_count, paddr }. This will allow me to implement lazy zeroing and COW pages. --- Kernel/Process.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'Kernel/Process.cpp') diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index d3724b7c7e..701065d7e7 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -17,6 +17,7 @@ //#define DEBUG_IO //#define TASK_DEBUG +//#define FORK_DEBUG //#define SCHEDULER_DEBUG // FIXME: Only do a single validation for accesses that don't span multiple pages. @@ -144,11 +145,11 @@ Region* Process::allocate_region(LinearAddress laddr, size_t size, String&& name laddr.mask(0xfffff000); - auto zone = MM.createZone(size); - ASSERT(zone); - - m_regions.append(adopt(*new Region(laddr, size, move(zone), move(name), is_readable, is_writable))); + unsigned page_count = ceilDiv(size, PAGE_SIZE); + auto physical_pages = MM.allocate_physical_pages(page_count); + ASSERT(physical_pages.size() == page_count); + m_regions.append(adopt(*new Region(laddr, size, move(physical_pages), move(name), is_readable, is_writable))); MM.mapRegion(*this, *m_regions.last()); return m_regions.last().ptr(); } @@ -1258,20 +1259,6 @@ Process* Process::kernelProcess() return s_kernelProcess; } -Region::Region(LinearAddress a, size_t s, RetainPtr&& z, String&& n, bool r, bool w) - : linearAddress(a) - , size(s) - , zone(move(z)) - , name(move(n)) - , is_readable(r) - , is_writable(w) -{ -} - -Region::~Region() -{ -} - bool Process::isValidAddressForKernel(LinearAddress laddr) const { // We check extra carefully here since the first 4MB of the address space is identity-mapped. -- cgit v1.2.3