mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 22:14:37 +00:00
Refactor panic handler and assertion failed display functions
This commit is contained in:
parent
87e263f5fe
commit
e09d93e2bb
@ -39,10 +39,11 @@
|
|||||||
#include "../../kernel.h"
|
#include "../../kernel.h"
|
||||||
|
|
||||||
extern const char *x86ExceptionMnemonics[];
|
extern const char *x86ExceptionMnemonics[];
|
||||||
extern void DisplayCrashScreen(CPU::ExceptionFrame *Frame);
|
extern void DisplayCrashScreen(CPU::ExceptionFrame *);
|
||||||
extern bool UserModeExceptionHandler(CPU::ExceptionFrame *Frame);
|
extern bool UserModeExceptionHandler(CPU::ExceptionFrame *);
|
||||||
extern void DisplayStackSmashing();
|
extern void DisplayStackSmashing();
|
||||||
extern void DisplayBufferOverflow();
|
extern void DisplayBufferOverflow();
|
||||||
|
extern void DisplayAssertionFailed(const char *, int, const char *);
|
||||||
|
|
||||||
Video::Font *CrashFont = nullptr;
|
Video::Font *CrashFont = nullptr;
|
||||||
void *FbBeforePanic = nullptr;
|
void *FbBeforePanic = nullptr;
|
||||||
@ -350,3 +351,10 @@ nsa __noreturn void HandleBufferOverflow()
|
|||||||
DisplayBufferOverflow();
|
DisplayBufferOverflow();
|
||||||
CPU::Stop();
|
CPU::Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXTERNC nsa __noreturn void HandleAssertionFailed(const char *File, int Line,
|
||||||
|
const char *Expression)
|
||||||
|
{
|
||||||
|
DisplayAssertionFailed(File, Line, Expression);
|
||||||
|
CPU::Stop();
|
||||||
|
}
|
||||||
|
@ -742,8 +742,7 @@ nsa void DisplayBufferOverflow()
|
|||||||
/* TODO: Add additional info */
|
/* TODO: Add additional info */
|
||||||
}
|
}
|
||||||
|
|
||||||
EXTERNC nsa __noreturn void DisplayAssertionFailed(const char *File, int Line,
|
nsa void DisplayAssertionFailed(const char *File, int Line, const char *Expression)
|
||||||
const char *Expression)
|
|
||||||
{
|
{
|
||||||
InitFont();
|
InitFont();
|
||||||
Display->ClearBuffer();
|
Display->ClearBuffer();
|
||||||
@ -768,7 +767,8 @@ EXTERNC nsa __noreturn void DisplayAssertionFailed(const char *File, int Line,
|
|||||||
ExPrint(" Please create a new issue on \e00AAFFhttps://github.com/Fennix-Project/Fennix\eFAFAFA for further assistance.\n");
|
ExPrint(" Please create a new issue on \e00AAFFhttps://github.com/Fennix-Project/Fennix\eFAFAFA for further assistance.\n");
|
||||||
|
|
||||||
Display->UpdateBuffer();
|
Display->UpdateBuffer();
|
||||||
CPU::Stop();
|
|
||||||
|
/* TODO: Add additional info */
|
||||||
}
|
}
|
||||||
|
|
||||||
nsa void ArrowInput(uint8_t key)
|
nsa void ArrowInput(uint8_t key)
|
||||||
|
@ -20,18 +20,18 @@
|
|||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
EXTERNC void __attribute__((noreturn)) DisplayAssertionFailed(const char *File, int Line,
|
EXTERNC void __attribute__((noreturn)) HandleAssertionFailed(const char *File, int Line,
|
||||||
const char *Expression);
|
const char *Expression);
|
||||||
|
|
||||||
#define assert(x) \
|
#define assert(x) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (__builtin_expect(!!(!(x)), 0)) \
|
if (__builtin_expect(!!(!(x)), 0)) \
|
||||||
{ \
|
{ \
|
||||||
error("Assertion failed! [%s]", #x); \
|
error("Assertion failed! [%s]", #x); \
|
||||||
DisplayAssertionFailed(__FILE__, __LINE__, #x); \
|
HandleAssertionFailed(__FILE__, __LINE__, #x); \
|
||||||
__builtin_unreachable(); \
|
__builtin_unreachable(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define assert_allow_continue(x) \
|
#define assert_allow_continue(x) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user