forked from Bananymous/banan-os
Kernel: Add helper to map pages with base address and size
This allows us to easily map enough pages for buffer with known size VESA driver can now allocate enough memory for whole framebuffer if it doesn't fit in a single page (1920x1080 for example)
This commit is contained in:
@@ -85,4 +85,11 @@ namespace Paging
|
||||
asm volatile("invlpg (%0)" :: "r"(address) : "memory");
|
||||
}
|
||||
|
||||
void MapPages(uintptr_t address, size_t size)
|
||||
{
|
||||
address = (address >> 21) << 21;
|
||||
for (size_t offset = 0; offset < size; offset += 1 << 21)
|
||||
MapPage(address + offset);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace VESA
|
||||
s_height = framebuffer.height;
|
||||
s_mode = framebuffer.type;
|
||||
|
||||
Paging::MapPage(framebuffer.addr);
|
||||
Paging::MapPages(s_addr, s_pitch * s_height);
|
||||
|
||||
if (s_mode == MULTIBOOT_FRAMEBUFFER_TYPE_GRAPHICS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user