summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKA/Sources/KernelCheck.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-27 19:37:29 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-27 19:37:29 +0200
commitc9e0e4b6058f833f39c2193e217dc38f4edd8b82 (patch)
tree7eadd57a88b51fc70ffd2668c7adc29386650e91 /dev/ZKA/Sources/KernelCheck.cxx
parentfdbcbba07cac3dbf9ef377f2f5248dd662f6babd (diff)
[WIP] Finishing SMP support, and then working on system driver and
loader. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/Sources/KernelCheck.cxx')
-rw-r--r--dev/ZKA/Sources/KernelCheck.cxx34
1 files changed, 27 insertions, 7 deletions
diff --git a/dev/ZKA/Sources/KernelCheck.cxx b/dev/ZKA/Sources/KernelCheck.cxx
index a5389b39..3057fe65 100644
--- a/dev/ZKA/Sources/KernelCheck.cxx
+++ b/dev/ZKA/Sources/KernelCheck.cxx
@@ -5,6 +5,7 @@
------------------------------------------- */
#include <ArchKit/ArchKit.hxx>
+#include <KernelKit/Timer.hxx>
#include <KernelKit/DebugOutput.hxx>
#include <NewKit/KernelCheck.hxx>
#include <NewKit/String.hxx>
@@ -20,7 +21,7 @@
#define CopyMem(dst, src, sz) Kernel::rt_copy_memory((Kernel::VoidPtr)src, (Kernel::VoidPtr)dst, sz)
#define MoveMem(dst, src, sz) Kernel::rt_copy_memory((Kernel::VoidPtr)src, (Kernel::VoidPtr)dst, sz)
-#define cWebsiteMacro "https://zka.nl/help"
+#define cWebsiteMacro "https://help.el-mahrouss-logic.com/"
/* Each error code is attributed with an ID, which will prompt a string onto the
* screen. Wait for debugger... */
@@ -31,7 +32,7 @@ namespace Kernel
{
CGInit();
- auto panicTxt = RGB(0xff, 0xff, 0xff);
+ auto panicTxt = RGB(0xff, 0xff, 0xff);
CG::CGDrawBackground();
@@ -39,6 +40,11 @@ namespace Kernel
auto x = 10;
CGDrawString("newoskrnl.dll Stopped working properly so it had to stop.", start_y, x, panicTxt);
+ start_y += 10;
+
+ // simply offset from previous string and then write the website.
+ CGDrawString("Please visit: ", start_y, x, panicTxt);
+ CGDrawString(cWebsiteMacro, start_y, x + (FONT_SIZE_X * rt_string_len("Please visit: ")), panicTxt);
CGFini();
@@ -54,34 +60,42 @@ namespace Kernel
}
case RUNTIME_CHECK_ACPI: {
CGDrawString("0x00000006 ACPI configuration error.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
case RUNTIME_CHECK_FILESYSTEM: {
CGDrawString("0x0000000A Filesystem corruption error.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
case RUNTIME_CHECK_POINTER: {
CGDrawString("0x00000000 Kernel heap pointer error, surely corrupted.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
case RUNTIME_CHECK_BAD_BEHAVIOR: {
CGDrawString("0x00000009 Undefined behavior error, image had to stop.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
case RUNTIME_CHECK_BOOTSTRAP: {
CGDrawString("0x0000000A End of boot code, but nothing to continue.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
case RUNTIME_CHECK_HANDSHAKE: {
CGDrawString("0x00000005 Bad handshake error.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
case RUNTIME_CHECK_IPC: {
CGDrawString("0x00000003 Bad kernel IPC error.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
case RUNTIME_CHECK_INVALID_PRIVILEGE: {
CGDrawString("0x00000007 Kernel privilege violation.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
case RUNTIME_CHECK_UNEXCPECTED: {
CGDrawString("0x0000000B Catasrophic kernel failure.", start_y, x, panicTxt);
@@ -89,24 +103,30 @@ namespace Kernel
}
case RUNTIME_CHECK_FAILED: {
CGDrawString("0x10000001 Assertion failed.", start_y, x, panicTxt);
+ RecoveryFactory::Recover();
break;
}
default: {
+ RecoveryFactory::Recover();
CGDrawString("0xFFFFFFFC Unknown kernel error.", start_y, x, panicTxt);
break;
}
}
};
- RecoveryFactory::Recover();
+ while (Yes)
+ ;
}
Void RecoveryFactory::Recover() noexcept
{
- while (Yes)
- {
- asm volatile("cli; hlt");
- }
+ const auto cMaxSeconds = Seconds(4);
+
+ HardwareTimer timer(cMaxSeconds);
+ timer.Wait();
+
+ PowerFactoryInterface power(nullptr);
+ power.Reboot();
}
void ke_runtime_check(bool expr, const Char* file, const Char* line)