summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-05 10:23:00 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-05 10:23:00 +0100
commit72cdc62155be8af67ff9328bc4226a69bbbb659c (patch)
treebe86883b319ff581da9b04007ece362ebc75f4fe /Kernel/Process.cpp
parentb5c5286ee19b6414ad20496e31913efb79002b2c (diff)
downloadserenity-72cdc62155be8af67ff9328bc4226a69bbbb659c.zip
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.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp23
1 files changed, 5 insertions, 18 deletions
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<Zone>&& 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.