diff --git a/kaleid/include/kernel/base.h b/kaleid/include/kernel/base.h index a053f8f..e6efe12 100644 --- a/kaleid/include/kernel/base.h +++ b/kaleid/include/kernel/base.h @@ -107,7 +107,7 @@ struct BootInfo_t uint modulesCount; //mods_count void *modulesAddr; //mods_addr char *grubName; //boot_loader_name - void *mbHeaderAddr; + void *kernelAddr; } btldr; // Informations about drives diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 5a313de..0dac2bf 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -32,9 +32,7 @@ // void InitBootInfo(multiboot_info_t *mbi) { - extern uint MB_header; - char *okStr = "available"; - char *noStr = "unavailable"; + extern void MB_header(void); // We need the multiboot structure KalAlwaysAssert(mbi); @@ -44,7 +42,7 @@ void InitBootInfo(multiboot_info_t *mbi) if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_BOOT_LOADER_NAME) { GetBootInfo(btldr).grubName = (char*)(ullong)(mbi->boot_loader_name); - GetBootInfo(btldr).mbHeaderAddr = (void*)(ullong)&MB_header; + GetBootInfo(btldr).kernelAddr = (void*)&MB_header; GetBootInfo(btldr).valid = 1; } if (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MODS) { @@ -103,28 +101,6 @@ void InitBootInfo(multiboot_info_t *mbi) GetBootInfo(firmware).apmTable = mbi->apm_table; GetBootInfo(firmware).apmValid = 1; } - - //Now we check (debug) - /*DebugLog("[InitBootInfo] Flags : %b\n\n", - GetBootInfo(btldr).grubFlags);*/ - DebugLog("[InitBootInfo] Boot loader %s\n", - GetBootInfo(btldr).valid ? okStr : noStr); - DebugLog("[InitBootInfo] Boot drive %s\n", - GetBootInfo(drives).drvValid ? okStr : noStr); - DebugLog("[InitBootInfo] Disk buffer %s\n", - GetBootInfo(drives).bufferValid ? okStr : noStr); - DebugLog("[InitBootInfo] Basic mem %s\n", - GetBootInfo(memory).memValid ? okStr : noStr); - DebugLog("[InitBootInfo] Memory map %s\n", - GetBootInfo(memory).mapValid ? okStr : noStr); - DebugLog("[InitBootInfo] Video infos %s\n", - GetBootInfo(video).vbeValid ? okStr : noStr); - DebugLog("[InitBootInfo] Framebuffer %s\n", - GetBootInfo(video).fbuValid ? okStr : noStr); - DebugLog("[InitBootInfo] ROM table %s\n", - GetBootInfo(firmware).romValid ? okStr : noStr); - DebugLog("[InitBootInfo] APM table %s\n\n", - GetBootInfo(firmware).apmValid ? okStr : noStr); } @@ -136,6 +112,9 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic) // We're not ready to deal with interrupts DisableIRQs(); + //Initialize the BootInfo_t structure + InitBootInfo(mbInfo); + // Kernel terminals InitTerms(); @@ -143,10 +122,10 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic) KernLog("%c%c%c OS/K\n\n", 219, 219, 219); KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC); - KernLog("[Init] We have magic : %x\n\n", mbMagic); - - //Initialize the BootInfo_t structure - InitBootInfo(mbInfo); + KernLog("[Init] Kernel successfully loaded at %p with %x magic\n\n", + GetBootInfo(btldr).kernelAddr, + mbMagic + ); //Memory mapping error_t mapBad = InitMemoryMap(); @@ -154,6 +133,6 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic) StartPanic("[Init] The memory map failed to initialize. Error : %d", mapBad); // We're out - KernLog("\n[Init] Evil never dies !"); + KernLog("\n[Init] Evil never dies !\n"); CrashSystem(); //yay } diff --git a/kaleid/kernel/io/vga.c b/kaleid/kernel/io/vga.c index 600eae0..b24f876 100644 --- a/kaleid/kernel/io/vga.c +++ b/kaleid/kernel/io/vga.c @@ -76,9 +76,9 @@ Terminal_t VGA_Terminal = { .name = "VGA Output Terminal", .type = "VGA", - .data = (void *)0xB8000, - .width = 80, - .height = 25, + .data = (void *)0, + .width = 0, + .height = 0, .currentX = 0, .currentY = 0, @@ -90,7 +90,6 @@ Terminal_t VGA_Terminal = { .putchar = VGA_PutOnTermUnlocked, }; - // // Initialize VGA output // @@ -98,6 +97,11 @@ void VGA_Init(void) { KalAssert(VGA_Terminal.initDone != INITOK); + //Use the infos provided in the BootInfo_t structure + VGA_Terminal.data = GetBootInfo(video).framebufferAddr; + VGA_Terminal.width = GetBootInfo(video).framebufferWidth; + VGA_Terminal.height = GetBootInfo(video).framebufferHeight; + VGA_Terminal.initDone = INITOK; }