summaryrefslogtreecommitdiff
path: root/Kernel/VM/PhysicalRegion.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-07-06 21:35:15 -0600
committerAndreas Kling <kling@serenityos.org>2021-07-08 11:43:34 +0200
commitad5d9d648b835f665e7a3e3eb0847c651d9c8c20 (patch)
treecf8cda17875653eac0724423dcf4108f9083806d /Kernel/VM/PhysicalRegion.cpp
parent658b41a06ced912ade47914d9f2f3f0691c0caad (diff)
downloadserenity-ad5d9d648b835f665e7a3e3eb0847c651d9c8c20.zip
Kernel: Use PAE to allow accessing all physical memory beyond 4GB
We already use PAE for the NX bit, but this changes the PhysicalAddress structure to be able to hold 64 bit physical addresses. This allows us to use all the available physical memory.
Diffstat (limited to 'Kernel/VM/PhysicalRegion.cpp')
-rw-r--r--Kernel/VM/PhysicalRegion.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/VM/PhysicalRegion.cpp b/Kernel/VM/PhysicalRegion.cpp
index 420442bf41..c95474798b 100644
--- a/Kernel/VM/PhysicalRegion.cpp
+++ b/Kernel/VM/PhysicalRegion.cpp
@@ -76,7 +76,7 @@ Optional<unsigned> PhysicalRegion::find_one_free_page()
// Check if we can draw one from the return queue
if (m_recently_returned.size() > 0) {
u8 index = get_fast_random<u8>() % m_recently_returned.size();
- Checked<FlatPtr> local_offset = m_recently_returned[index].get();
+ Checked<PhysicalPtr> local_offset = m_recently_returned[index].get();
local_offset -= m_lower.get();
m_recently_returned.remove(index);
VERIFY(!local_offset.has_overflow());
@@ -131,7 +131,7 @@ RefPtr<PhysicalPage> PhysicalRegion::take_free_page(bool supervisor)
if (!free_index.has_value())
return nullptr;
- return PhysicalPage::create(m_lower.offset(free_index.value() * PAGE_SIZE), supervisor);
+ return PhysicalPage::create(m_lower.offset((PhysicalPtr)free_index.value() * PAGE_SIZE), supervisor);
}
void PhysicalRegion::free_page_at(PhysicalAddress addr)
@@ -142,10 +142,10 @@ void PhysicalRegion::free_page_at(PhysicalAddress addr)
VERIFY_NOT_REACHED();
}
- Checked<FlatPtr> local_offset = addr.get();
+ Checked<PhysicalPtr> local_offset = addr.get();
local_offset -= m_lower.get();
VERIFY(!local_offset.has_overflow());
- VERIFY(local_offset.value() < (FlatPtr)(m_pages * PAGE_SIZE));
+ VERIFY(local_offset.value() < ((PhysicalPtr)m_pages * PAGE_SIZE));
auto page = local_offset.value() / PAGE_SIZE;
m_bitmap.set(page, false);