summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/KernelCheck.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-23 02:58:39 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-23 02:58:39 +0100
commit5563deabd8f7ce3fc713ea23f8cf5bbac33b4024 (patch)
treef182700a0360ecf7319415915638e44a5d0074dc /Private/Source/KernelCheck.cxx
parentab4eaababec7f870378ed64fbbf51b154b292a7b (diff)
Kernel: add heap information (allocator)
- Force use of itanium ABI even of MPCC. - Revision of handover has been done. (it is not assuming any starting address) Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/KernelCheck.cxx')
-rw-r--r--Private/Source/KernelCheck.cxx83
1 files changed, 83 insertions, 0 deletions
diff --git a/Private/Source/KernelCheck.cxx b/Private/Source/KernelCheck.cxx
new file mode 100644
index 00000000..4fc24918
--- /dev/null
+++ b/Private/Source/KernelCheck.cxx
@@ -0,0 +1,83 @@
+/*
+ * ========================================================
+ *
+ * HCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#include <ArchKit/ArchKit.hpp>
+#include <KernelKit/DebugOutput.hpp>
+#include <NewKit/KernelCheck.hpp>
+#include <NewKit/String.hpp>
+
+extern "C" [[noreturn]] void ke_wait_for_debugger() {
+ while (true) {
+ HCore::HAL::rt_cli();
+ HCore::HAL::rt_halt();
+ }
+}
+
+/* Each error code is attributed with an ID, which will prompt a string onto the
+ * screen. Wait for debugger... */
+
+namespace HCore {
+void ke_stop(const HCore::Int &id) {
+ kcout << "*** STOP *** \r\n";
+ kcout << "*** HCoreKrnl.exe has trigerred a runtime stop. *** \r\n";
+
+ switch (id) {
+ case RUNTIME_CHECK_PROCESS: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_PROCESS *** \r\n";
+ break;
+ }
+ case RUNTIME_CHECK_ACPI: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_ACPI *** \r\n";
+ break;
+ }
+ case RUNTIME_CHECK_POINTER: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_POINTER *** \r\n";
+ break;
+ }
+ case RUNTIME_CHECK_BAD_BEHAVIOR: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_BAD_BEHAVIOR *** \r\n";
+ break;
+ }
+ case RUNTIME_CHECK_BOOTSTRAP: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_BOOTSTRAP *** \r\n";
+ break;
+ }
+ case RUNTIME_CHECK_HANDSHAKE: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_HANDSHAKE *** \r\n";
+ break;
+ }
+ case RUNTIME_CHECK_LD: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_LD *** \r\n";
+ break;
+ }
+ case RUNTIME_CHECK_INVALID_PRIVILEGE: {
+ kcout << "*** CAUSE: RUNTIME_CHECK_INVALID_PRIVILEGE *** \r\n";
+ break;
+ }
+ };
+
+ DumpManager::Dump();
+
+#ifdef __DEBUG__
+ ke_wait_for_debugger();
+#endif // ifdef __DEBUG__
+}
+
+void ke_runtime_check(bool expr, const char *file, const char *line) {
+ if (!expr) {
+#ifdef __DEBUG__
+ kcout << "Krnl: File: " << file << "\n";
+ kcout << "Krnl: Line: " << line << "\n";
+
+#endif // __DEBUG__
+
+ HCore::ke_stop(RUNTIME_CHECK_FAILED); // Runtime Check failed
+ }
+}
+} // namespace HCore