diff --git a/kernel/arch/i386/Paging.cpp b/kernel/arch/i386/Paging.cpp index d7b651e7..7bd0a758 100644 --- a/kernel/arch/i386/Paging.cpp +++ b/kernel/arch/i386/Paging.cpp @@ -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); + } + } \ No newline at end of file diff --git a/kernel/arch/i386/VESA.cpp b/kernel/arch/i386/VESA.cpp index 4413dc1b..65165858 100644 --- a/kernel/arch/i386/VESA.cpp +++ b/kernel/arch/i386/VESA.cpp @@ -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) { diff --git a/kernel/include/kernel/Paging.h b/kernel/include/kernel/Paging.h index 024fe531..4b208d5a 100644 --- a/kernel/include/kernel/Paging.h +++ b/kernel/include/kernel/Paging.h @@ -1,5 +1,6 @@ #pragma once +#include #include namespace Paging @@ -8,5 +9,6 @@ namespace Paging void Initialize(); void MapPage(uintptr_t address); + void MapPages(uintptr_t address, size_t size); } \ No newline at end of file