summaryrefslogtreecommitdiff
path: root/Kernel/VM/PhysicalRegion.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-12-05 22:49:24 -0700
committerAndreas Kling <kling@serenityos.org>2021-01-28 18:52:59 +0100
commitaffb4ef01bcd3b8ac316c95738fb5baaf6b17963 (patch)
tree291b29a644281776ffc954a4d0cb9dddf58edf51 /Kernel/VM/PhysicalRegion.h
parentd5472426ecb0a6c1e784add823c83b38e1b5ccb7 (diff)
downloadserenity-affb4ef01bcd3b8ac316c95738fb5baaf6b17963.zip
Kernel: Allow specifying a physical alignment when allocating
Some drivers may require allocating contiguous physical pages with a specific alignment for the physical address.
Diffstat (limited to 'Kernel/VM/PhysicalRegion.h')
-rw-r--r--Kernel/VM/PhysicalRegion.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/VM/PhysicalRegion.h b/Kernel/VM/PhysicalRegion.h
index 4997b30499..436ee6cce3 100644
--- a/Kernel/VM/PhysicalRegion.h
+++ b/Kernel/VM/PhysicalRegion.h
@@ -52,12 +52,12 @@ public:
bool contains(const PhysicalPage& page) const { return page.paddr() >= m_lower && page.paddr() <= m_upper; }
RefPtr<PhysicalPage> take_free_page(bool supervisor);
- NonnullRefPtrVector<PhysicalPage> take_contiguous_free_pages(size_t count, bool supervisor);
+ NonnullRefPtrVector<PhysicalPage> take_contiguous_free_pages(size_t count, bool supervisor, size_t physical_alignment = PAGE_SIZE);
void return_page(const PhysicalPage& page);
private:
- unsigned find_contiguous_free_pages(size_t count);
- Optional<unsigned> find_and_allocate_contiguous_range(size_t count);
+ unsigned find_contiguous_free_pages(size_t count, size_t physical_alignment = PAGE_SIZE);
+ Optional<unsigned> find_and_allocate_contiguous_range(size_t count, unsigned alignment = 1);
Optional<unsigned> find_one_free_page();
void free_page_at(PhysicalAddress addr);