This commit is contained in:
Adrien Bourmault 2019-03-19 14:08:00 +01:00
commit 9ea4daecbd
5 changed files with 8 additions and 21 deletions

View File

@ -84,16 +84,6 @@ noreturn void __assert_handler(const char *, const char *, int, const char *);
// //
#define KalAssert KalAlwaysAssert #define KalAssert KalAlwaysAssert
#ifndef _OSK_SOURCE
// When not building for OS/K, use the system's assert
#include <assert.h>
#undef KalAlwaysAssert
#define KalAlwaysAssert assert
#endif
//------------------------------------------// //------------------------------------------//
// When not debugging // // When not debugging //
//------------------------------------------// //------------------------------------------//

View File

@ -61,7 +61,6 @@ typedef enum TermColor_t TermColor_t;
// Get Process_t structure of current CPU // Get Process_t structure of current CPU
#define GetCurCPU() (cpuTable[_GetCurCPU()]) #define GetCurCPU() (cpuTable[_GetCurCPU()])
#define PANICSTR_SIZE 1024
//Get the BootInfo_t structure //Get the BootInfo_t structure
#define GetBootInfo(x) bootTab.x #define GetBootInfo(x) bootTab.x
@ -75,9 +74,6 @@ struct Processor_t
// CPU number, index in CPU list // CPU number, index in CPU list
int index; int index;
// Panic string
char panicStr[PANICSTR_SIZE];
// Number of ticks since boot time // Number of ticks since boot time
ulong ticks; ulong ticks;

View File

@ -31,7 +31,8 @@
//------------------------------------------// //------------------------------------------//
extern volatile char *PanicStr; #define PANICSTR_SIZE 1024
extern volatile char PanicStr[PANICSTR_SIZE];
//------------------------------------------// //------------------------------------------//

View File

@ -29,6 +29,6 @@ Processor_t cpuTable[NCPUS] = {0};
BootInfo_t bootTab = {0}; BootInfo_t bootTab = {0};
Terminal_t *StdOut = 0, *StdDbg = 0; Terminal_t *StdOut = 0, *StdDbg = 0;
volatile char *PanicStr = 0;
Terminal_t *stdOut = 0, *stdDbg = 0; volatile char PanicStr[PANICSTR_SIZE] = {0};

View File

@ -37,8 +37,8 @@ noreturn void __assert_handler(const char *msg,
(void)file; (void)line; (void)func; (void)file; (void)line; (void)func;
StartPanic("cpu%d: In function '%s', from %s line %d - assertion failed: '%s'", StartPanic("In function '%s', from %s line %d - assertion failed: '%s'",
_GetCurCPU(), func, file, line, msg); func, file, line, msg);
} }
// //
@ -64,11 +64,11 @@ noreturn void StartPanic(const char *fmt, ...)
} }
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(PanicStr, PANICSTR_SIZE, fmt, ap); vsnprintf((char *)PanicStr, PANICSTR_SIZE, fmt, ap);
va_end(ap); va_end(ap);
PrintOnTermUnlocked(StdOut, "\nPanic!\n\n"); PrintOnTermUnlocked(StdOut, "\nPanic!\n\n");
PrintOnTermUnlocked(StdOut, PanicStr); PrintOnTermUnlocked(StdOut, (char *)PanicStr);
HaltCPU(); HaltCPU();
} }