diff --git a/kernel/src/Log.cpp b/kernel/src/Log.cpp index 1a7c34c9..63519d43 100644 --- a/kernel/src/Log.cpp +++ b/kernel/src/Log.cpp @@ -1,4 +1,5 @@ #include "Log.h" +#include "arch/CPU.h" #include "arch/Serial.h" #include "arch/Timer.h" #include "video/TextConsole.h" @@ -112,4 +113,16 @@ bool log_serial_enabled() bool log_text_console_enabled() { return g_text_console_enabled; +} + +static bool g_check_already_failed = false; + +_noreturn bool __check_failed(const char* file, const char* line, const char* func, const char* expr) +{ + if (!g_check_already_failed) + { // Avoid endlessly failing when trying to report a failed check. + g_check_already_failed = true; + kerrorln("ERROR: Check failed at %s:%s, in %s: %s", file, line, func, expr); + } + CPU::efficient_halt(); } \ No newline at end of file diff --git a/kernel/src/arch/Serial.cpp b/kernel/src/arch/Serial.cpp index 9a00a751..2dc834ac 100644 --- a/kernel/src/arch/Serial.cpp +++ b/kernel/src/arch/Serial.cpp @@ -34,16 +34,4 @@ namespace Serial va_end(ap); return rc; } -} - -static bool g_check_already_failed = false; - -_noreturn bool __check_failed(const char* file, const char* line, const char* func, const char* expr) -{ - if (!g_check_already_failed) - { // Avoid endlessly failing when trying to report a failed check. - g_check_already_failed = true; - Serial::printf("ERROR: Check failed at %s:%s, in %s: %s\n", file, line, func, expr); - } - CPU::efficient_halt(); } \ No newline at end of file