1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

Kernel: Allow contiguous allocations in physical memory

For that, we have a new type of VMObject, called
ContiguousVMObject, that is responsible for allocating contiguous
physical pages.
This commit is contained in:
Liav A 2020-03-07 19:24:41 +02:00 committed by Andreas Kling
parent b066586355
commit d6e122fd3a
8 changed files with 219 additions and 23 deletions

View file

@ -28,6 +28,7 @@
#include <AK/Bitmap.h>
#include <AK/NonnullRefPtr.h>
#include <AK/Optional.h>
#include <AK/RefCounted.h>
#include <Kernel/VM/PhysicalPage.h>
@ -51,10 +52,14 @@ public:
bool contains(PhysicalPage& page) const { return page.paddr() >= m_lower && page.paddr() <= m_upper; }
RefPtr<PhysicalPage> take_free_page(bool supervisor);
Vector<RefPtr<PhysicalPage>> take_contiguous_free_pages(size_t count, bool supervisor);
void return_page_at(PhysicalAddress addr);
void return_page(PhysicalPage&& page) { return_page_at(page.paddr()); }
private:
unsigned find_contiguous_free_pages(size_t count);
Optional<unsigned> find_and_allocate_contiguous_range(size_t count);
PhysicalRegion(PhysicalAddress lower, PhysicalAddress upper);
PhysicalAddress m_lower;