From 7a663b224f463d49b793eefd6c0c22624921cf34 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 17 May 2019 21:10:22 +0200 Subject: [PATCH] clean the IHM '-' --- kaleid/kernel/init/info.c | 4 ++-- kaleid/kernel/ke/idt.c | 11 ++++++----- kaleid/kernel/ke/rtc.c | 2 +- kaleid/kernel/mm/heap.c | 4 ++-- kaleid/kernel/mm/map.c | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/kaleid/kernel/init/info.c b/kaleid/kernel/init/info.c index 8fde487..9849ae1 100644 --- a/kaleid/kernel/init/info.c +++ b/kaleid/kernel/init/info.c @@ -110,9 +110,9 @@ void BtInitBootInfo(multiboot_info_t *mbi, void *codeSeg) void BtDoSanityChecks(uint mbMagic) { if (!(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC)) - KeStartPanic("[Init]\tMagic number %x is incorrect\n", mbMagic); + KeStartPanic("\tMagic number %x is incorrect\n", mbMagic); - DebugLog("[Init]\tKernel successfully loaded at %p\n", + DebugLog("\tKernel successfully loaded at %p\n", BtLoaderInfo.kernelAddr); } diff --git a/kaleid/kernel/ke/idt.c b/kaleid/kernel/ke/idt.c index 7dec12e..32899a7 100644 --- a/kaleid/kernel/ke/idt.c +++ b/kaleid/kernel/ke/idt.c @@ -147,7 +147,7 @@ void KeSetupIDT(void) KeSetIDTGate(0x1B, (ulong)isr27, codeSeg, 0x8E); // INTEL RESERVED KeSetIDTGate(0x1C, (ulong)isr28, codeSeg, 0x8E); // INTEL RESERVED KeSetIDTGate(0x1D, (ulong)isr29, codeSeg, 0x8E); // INTEL RESERVED - KeSetIDTGate(0x1E, (ulong)isr30, codeSeg, 0x8E); // INTEL RESERVED + KeSetIDTGate(0x1E, (ulong)isr30, codeSeg, 0x8E); KeSetIDTGate(0x1F, (ulong)isr31, codeSeg, 0x8E); // INTEL RESERVED // Set IDT IRQs Gates @@ -175,7 +175,7 @@ void KeSetupIDT(void) // Load IDT KeLoadIDT(); - DebugLog("[IdtSetup] Initialized !\n"); + DebugLog("\tInterrupt table initialized\n"); } // @@ -252,10 +252,10 @@ void _KeHandleISR(ISRFrame_t *regs) if ((!regs) || (!regs->rip)) KeStartPanic("[ISR ?] Unknown ISR Exception Abort\n"); - if ((regs->intNo >= 0x15) && (regs->intNo <= 0x1F)) + if ((regs->intNo >= 0x15) && (regs->intNo <= 0x1D)) return; // INTEL RESERVED - if (regs->intNo == 0x0F) + if ((regs->intNo == 0x0F) || (regs->intNo == 0x1F)) return; // INTEL RESERVED for (int i = 0; i < isrList.n; i++) { @@ -276,7 +276,7 @@ void _KeHandleISR(ISRFrame_t *regs) static void EarlyExceptionHandler(ISRFrame_t *regs) { KeStartPanic("[ISR 0x%x] Irrecoverable Kernel %s\n\n" - " Error code : %p\n\n" + " Error code : 0x%x (%b)\n\n" " RIP: %#016lx CS: %#016lx RSP: %#016lx\n" " SS: %#016lx RAX: %#016lx RBX: %#016lx\n" " RCX: %#016lx RDX: %#016lx RSI: %#016lx\n" @@ -287,6 +287,7 @@ static void EarlyExceptionHandler(ISRFrame_t *regs) regs->intNo, ExceptionsChar[regs->intNo], regs->ErrorCode, + regs->ErrorCode, regs->rip, regs->cs, regs->rsp, diff --git a/kaleid/kernel/ke/rtc.c b/kaleid/kernel/ke/rtc.c index e580563..ebfc547 100644 --- a/kaleid/kernel/ke/rtc.c +++ b/kaleid/kernel/ke/rtc.c @@ -275,7 +275,7 @@ void KeEnableRTC(void) KeRegisterISR(HandleRTC, 0x28); // Setting up the register control and interrupt rates - DebugLog("[RTC Time] Interrupt frequency set to %d Hz\n", + DebugLog("\tRTC interrupt frequency set to %d Hz\n", 32768 >> (RTC_RATE - 1)); IoWriteByteOnPort(0x70, 0x8B); diff --git a/kaleid/kernel/mm/heap.c b/kaleid/kernel/mm/heap.c index a43f1ac..a968231 100644 --- a/kaleid/kernel/mm/heap.c +++ b/kaleid/kernel/mm/heap.c @@ -56,8 +56,8 @@ void MmInitHeap(void) _heap_end = _heap_start; _heap_max = lmin(MM_HEAP_MAX, MmGetAvailZoneSize(_heap_end)); - KernLog("[InitHeap] Start address : %p, Max length : %u Mio\n\n", - _heap_start, _heap_max / MB); + if ((ulong)_heap_start == _heap_max) + KeStartPanic("The heap failed to initialize ! (Not enough memory)"); } // diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index edf5352..b60c81e 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -41,7 +41,7 @@ void MmInitMemoryMap(void) rc = InitMemoryMap(); if (rc) - KeStartPanic("[Mm]\tThe memory map failed to initialize.\nError : %s", + KeStartPanic("\tThe memory map failed to initialize.\nError : %s", strerror(rc) ); } @@ -98,7 +98,7 @@ static error_t InitMemoryMap(void) if (memoryMap.freeRamSize < MINIMUM_RAM_SIZE) return ENOMEM; - KernLog("[Mm]\tAvailable Ram Size : %u Mio\n", + KernLog("\tAvailable RAM size : %u MB\n", memoryMap.freeRamSize / MB); // Magic value in memory to prevent smashing