forked from Bananymous/banan-os
Kernel: You can specify first vaddr for getting free pages
This commit is contained in:
parent
413f05bfca
commit
8352392b38
|
@ -382,11 +382,13 @@ namespace Kernel
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
vaddr_t PageTable::get_free_contiguous_pages(size_t page_count) const
|
vaddr_t PageTable::get_free_contiguous_pages(size_t page_count, vaddr_t first_address) const
|
||||||
{
|
{
|
||||||
|
ASSERT(first_address % PAGE_SIZE == 0);
|
||||||
|
|
||||||
LockGuard _(m_lock);
|
LockGuard _(m_lock);
|
||||||
|
|
||||||
for (vaddr_t vaddr = PAGE_SIZE; !(vaddr >> 48); vaddr += PAGE_SIZE)
|
for (vaddr_t vaddr = first_address; is_canonical(vaddr); vaddr += PAGE_SIZE)
|
||||||
{
|
{
|
||||||
bool valid { true };
|
bool valid { true };
|
||||||
for (size_t page = 0; page < page_count; page++)
|
for (size_t page = 0; page < page_count; page++)
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Kernel
|
||||||
bool is_range_free(vaddr_t, size_t bytes) const;
|
bool is_range_free(vaddr_t, size_t bytes) const;
|
||||||
|
|
||||||
vaddr_t get_free_page() const;
|
vaddr_t get_free_page() const;
|
||||||
vaddr_t get_free_contiguous_pages(size_t page_count) const;
|
vaddr_t get_free_contiguous_pages(size_t page_count, vaddr_t first_address = PAGE_SIZE) const;
|
||||||
|
|
||||||
void invalidate(vaddr_t);
|
void invalidate(vaddr_t);
|
||||||
void load();
|
void load();
|
||||||
|
|
Loading…
Reference in New Issue