From 99732384edb6beb48ad396eb1f881b6e39f61fe8 Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Tue, 19 Mar 2019 13:59:06 +0100 Subject: [PATCH 1/2] Panic fix --- kaleid/include/base/assert.h | 10 ---------- kaleid/include/kernel/base.h | 4 ---- kaleid/include/kernel/panic.h | 3 ++- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/kaleid/include/base/assert.h b/kaleid/include/base/assert.h index 97fadac..3f962bd 100644 --- a/kaleid/include/base/assert.h +++ b/kaleid/include/base/assert.h @@ -84,16 +84,6 @@ noreturn void __assert_handler(const char *, const char *, int, const char *); // #define KalAssert KalAlwaysAssert -#ifndef _OSK_SOURCE - -// When not building for OS/K, use the system's assert -#include - -#undef KalAlwaysAssert -#define KalAlwaysAssert assert - -#endif - //------------------------------------------// // When not debugging // //------------------------------------------// diff --git a/kaleid/include/kernel/base.h b/kaleid/include/kernel/base.h index f951a42..f8bdf6e 100644 --- a/kaleid/include/kernel/base.h +++ b/kaleid/include/kernel/base.h @@ -60,7 +60,6 @@ typedef enum TermColor_t TermColor_t; // Get Process_t structure of current CPU #define GetCurCPU() (cpuTable[_GetCurCPU()]) -#define PANICSTR_SIZE 1024 //------------------------------------------// @@ -72,9 +71,6 @@ struct Processor_t // CPU number, index in CPU list int index; - // Panic string - char panicStr[PANICSTR_SIZE]; - // Number of ticks since boot time ulong ticks; diff --git a/kaleid/include/kernel/panic.h b/kaleid/include/kernel/panic.h index ac80e6e..cdb53be 100644 --- a/kaleid/include/kernel/panic.h +++ b/kaleid/include/kernel/panic.h @@ -31,7 +31,8 @@ //------------------------------------------// -extern volatile char *PanicStr; +#define PANICSTR_SIZE 1024 +extern volatile char PanicStr[PANICSTR_SIZE]; //------------------------------------------// From ef1467ea469b006ad7108c50586b59b7502fe63e Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Tue, 19 Mar 2019 14:03:13 +0100 Subject: [PATCH 2/2] Panic fix --- kaleid/kernel/init/table.c | 6 +++--- kaleid/kernel/ke/panic.c | 8 ++++---- kaleid/kernel/mm/map.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kaleid/kernel/init/table.c b/kaleid/kernel/init/table.c index 10c52de..bc32fdb 100644 --- a/kaleid/kernel/init/table.c +++ b/kaleid/kernel/init/table.c @@ -27,8 +27,8 @@ int cpuCount = 1; Processor_t cpuTable[NCPUS] = {0}; -BootInfo_t bootTab = {0} +BootInfo_t bootTab = {0}; Terminal_t *StdOut = 0, *StdDbg = 0; -volatile char *PanicStr = 0; -Terminal_t *stdOut = 0, *stdDbg = 0; +volatile char PanicStr[PANICSTR_SIZE] = {0}; + diff --git a/kaleid/kernel/ke/panic.c b/kaleid/kernel/ke/panic.c index 4de0bfe..134ab33 100644 --- a/kaleid/kernel/ke/panic.c +++ b/kaleid/kernel/ke/panic.c @@ -37,8 +37,8 @@ noreturn void __assert_handler(const char *msg, (void)file; (void)line; (void)func; - StartPanic("cpu%d: In function '%s', from %s line %d - assertion failed: '%s'", - _GetCurCPU(), func, file, line, msg); + StartPanic("In function '%s', from %s line %d - assertion failed: '%s'", + func, file, line, msg); } // @@ -64,11 +64,11 @@ noreturn void StartPanic(const char *fmt, ...) } va_start(ap, fmt); - vsnprintf(PanicStr, PANICSTR_SIZE, fmt, ap); + vsnprintf((char *)PanicStr, PANICSTR_SIZE, fmt, ap); va_end(ap); PrintOnTermUnlocked(StdOut, "\nPanic!\n\n"); - PrintOnTermUnlocked(StdOut, PanicStr); + PrintOnTermUnlocked(StdOut, (char *)PanicStr); HaltCPU(); } diff --git a/kaleid/kernel/mm/map.c b/kaleid/kernel/mm/map.c index 6d29346..27b1748 100644 --- a/kaleid/kernel/mm/map.c +++ b/kaleid/kernel/mm/map.c @@ -28,7 +28,7 @@ error_t InitMemoryMap(void) { ///uint MapIsValid = (GetBootInfo(btldr).grubFlags & MULTIBOOT_INFO_MEM_MAP = MULTIBOOT_INFO_MEM_MAP ? 1 : 0); - KalAlwaysAssert(MapIsValid); + KalAlwaysAssert(0); return EOK; }