diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index 4f6c16f..31e46cb 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -110,16 +110,31 @@ void BtInitBootInfo(multiboot_info_t *mbi) } } +void BtInitSanity(uint mbMagic){ + uint tmp; + + KernLog("%c%c%c OS/K\n \n", 219, 219, 219); + + if (!(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC)) + KeStartPanic("[Init] Magic number %x is incorrect\n", mbMagic); + + tmp = (BtGetBootInfo(btldr).kernelEndAddr + - BtGetBootInfo(btldr).kernelAddr) / KB; + DebugLog("[Init] Kernel successfully loaded at %p with %x magic\n" + " and it uses %d Kio\n\n", + BtGetBootInfo(btldr).kernelAddr, + mbMagic,tmp); +} + + extern void pstest(void); extern error_t IoInitVGABuffer(void); // // Entry point of the Kaleid kernel // -noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic) +noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic) { - int tmp; - // We're not ready to deal with interrupts KeDisableIRQs(); @@ -129,26 +144,17 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic) // Get ready to print things IoInitVGABuffer(); - // Hello world - KernLog("%c%c%c OS/K\n \n", 219, 219, 219); - - KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC); - - tmp = (BtGetBootInfo(btldr).kernelEndAddr - - BtGetBootInfo(btldr).kernelAddr) / KB; - KernLog("[Init] Kernel successfully loaded at %p with %x magic\n" - " and it uses %d Kio\n\n", - BtGetBootInfo(btldr).kernelAddr, - mbMagic,tmp); + // Sanity checks and hello world + BtInitSanity(mbMagic); //Memory mapping MmInitMemoryMap(); MmInitHeap(); - int i = 0; - while(i < 512) { KernLog("%d\n", i++);} - + //int i = 0; + //while(i < 512) { KernLog("%d\n", i++);} + PsInitSched(); // We're out diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index 022dd57..3d39401 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -176,7 +176,7 @@ void *MmGetFirstAvailZone(void *start) { void MmPrintMemoryMap(void) { char *avStr = ""; - for (int i=0; i < memoryMap.length; i++) { + for (uint i=0; i < memoryMap.length; i++) { switch (memoryMap.entry[i].type) { case AVAILABLE_ZONE: avStr="Available";