Kernel: Use framebuffer virtual address instead of physical address

Just found out bootboot.fb_ptr was the physical address, not virtual.
That explains why we were getting page faults while writing to the physical address of the framebuffer. (we were in a user address space when doing so)
So this should probably make the system much more stable!!
This commit is contained in:
apio 2022-10-29 20:10:49 +02:00
parent 8395eb16f6
commit d1e4bc5504
2 changed files with 4 additions and 4 deletions

View File

@ -20,12 +20,13 @@
extern BOOTBOOT bootboot; extern BOOTBOOT bootboot;
extern "C" char environment[4096]; extern "C" char environment[4096];
extern uintptr_t fb;
uintptr_t __stack_chk_guard = 0xfeff34; uintptr_t __stack_chk_guard = 0xfeff34;
void Init::check_magic() void Init::check_magic()
{ {
ASSERT(strncmp((char*)bootboot.magic, BOOTBOOT_MAGIC, 4) == 0); if (strncmp((char*)bootboot.magic, BOOTBOOT_MAGIC, 4) != 0) hang();
} }
void Init::disable_smp() void Init::disable_smp()
@ -43,8 +44,7 @@ void Init::early_init()
asm_enable_sse(); asm_enable_sse();
framebuffer0.init((void*)bootboot.fb_ptr, bootboot.fb_type, bootboot.fb_scanline, bootboot.fb_width, framebuffer0.init((void*)&fb, bootboot.fb_type, bootboot.fb_scanline, bootboot.fb_width, bootboot.fb_height);
bootboot.fb_height);
MemoryManager::init(); MemoryManager::init();

View File

@ -23,8 +23,8 @@
extern "C" void _start() extern "C" void _start()
{ {
Init::check_magic();
Init::disable_smp(); // Put all other cores except the bootstrap one in an infinite loop Init::disable_smp(); // Put all other cores except the bootstrap one in an infinite loop
Init::check_magic();
Init::early_init(); Init::early_init();
kinfoln("Starting Moon %s", moon_version()); kinfoln("Starting Moon %s", moon_version());