diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-09 14:20:49 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-09 14:26:06 +0200 |
| commit | acd8297fe927e601a7173cec7ca5445fd4a9c74a (patch) | |
| tree | d5610bc9f9cad2b93dd102ccb80eadb291d3fc1c /Kernel | |
| parent | 30a6f8174ab44c12ccdfb212a2f6895440581d1a (diff) | |
[IMP] [KRNL DLL] Update stop code, not using serial output anymore.
[IMP] [CRT DLL] Add CRT DLL as well.
[HANDOVER] Update protocol by hiding an internal struct.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel')
| -rw-r--r-- | Kernel/FirmwareKit/Handover.hxx | 12 | ||||
| -rw-r--r-- | Kernel/HALKit/AMD64/HalKernelMain.cxx | 10 | ||||
| -rw-r--r--[-rwxr-xr-x] | Kernel/MoveAll.ARM64.sh | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | Kernel/MoveAll.X64.sh | 0 | ||||
| -rw-r--r-- | Kernel/Sources/KernelCheck.cxx | 71 |
5 files changed, 29 insertions, 64 deletions
diff --git a/Kernel/FirmwareKit/Handover.hxx b/Kernel/FirmwareKit/Handover.hxx index 23d92e59..75900508 100644 --- a/Kernel/FirmwareKit/Handover.hxx +++ b/Kernel/FirmwareKit/Handover.hxx @@ -51,18 +51,6 @@ namespace Kernel::HEL kArchCount = 2, }; - /** -@brief The first struct that we read when inspecting The executable -it tells us more about it and IS format independent. -*/ - typedef struct HandoverHeader final - { - UInt64 f_TargetMagic; - Int32 f_TargetType; - Int32 f_TargetArch; - UIntPtr f_TargetStartAddress; - } __attribute__((packed)) HandoverHeader, *HandoverHeaderPtr; - struct HandoverInformationHeader { UInt64 f_Magic; diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx index 520d0833..93841bc1 100644 --- a/Kernel/HALKit/AMD64/HalKernelMain.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx @@ -84,6 +84,8 @@ EXTERN_C void hal_init_platform( kTextOffsetY += 10; cg_write_text("SMP OS (MAX 8 CORES).", kTextOffsetY, 10, RGB(0x00, 0x00, 0x00)); + Kernel::ke_stop(RUNTIME_CHECK_BOOTSTRAP); + hal_real_init(); } @@ -137,7 +139,6 @@ void hal_real_init(void) constexpr auto cLPCSendMsg = 0x25; constexpr auto cLPCOpenMsg = 0x26; constexpr auto cLPCCloseMsg = 0x27; - constexpr auto cLPCSanitizeMsg = 0x28; kSyscalls[cTlsInterrupt].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void { if (tls_check_syscall_impl(rdx) == false) @@ -146,10 +147,6 @@ void hal_real_init(void) } }; - kSyscalls[cLPCSanitizeMsg].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void { - Kernel::ipc_sanitize_packet(reinterpret_cast<Kernel::IPC_MESSAGE_STRUCT*>(rdx)); - }; - kSyscalls[cNewInterrupt].Leak().Leak()->fProc = [](Kernel::VoidPtr rdx) -> void { // get HAC struct. HEAP_ALLOC_INFO* rdxInf = reinterpret_cast<HEAP_ALLOC_INFO*>(rdx); @@ -219,9 +216,6 @@ void hal_real_init(void) kSyscalls[cLastExitInterrupt].Leak().Leak()->fHooked = true; kSyscalls[cShutdownInterrupt].Leak().Leak()->fHooked = true; kSyscalls[cRebootInterrupt].Leak().Leak()->fHooked = true; - kSyscalls[cLPCSanitizeMsg].Leak().Leak()->fHooked = true; Kernel::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr); - - Kernel::ke_stop(RUNTIME_CHECK_BOOTSTRAP); } diff --git a/Kernel/MoveAll.ARM64.sh b/Kernel/MoveAll.ARM64.sh index 5198559f..5198559f 100755..100644 --- a/Kernel/MoveAll.ARM64.sh +++ b/Kernel/MoveAll.ARM64.sh diff --git a/Kernel/MoveAll.X64.sh b/Kernel/MoveAll.X64.sh index 664ad472..664ad472 100755..100644 --- a/Kernel/MoveAll.X64.sh +++ b/Kernel/MoveAll.X64.sh diff --git a/Kernel/Sources/KernelCheck.cxx b/Kernel/Sources/KernelCheck.cxx index 4752024d..bf3d91b6 100644 --- a/Kernel/Sources/KernelCheck.cxx +++ b/Kernel/Sources/KernelCheck.cxx @@ -32,27 +32,27 @@ namespace Kernel { CGInit(); - auto panicBack = RGB(0xDC, 0xF5, 0xF5); - auto panicTxt = RGB(0, 0, 0); - + auto panicBack = RGB(0xff, 0x3a, 0x3a); + auto panicTxt = RGB(0xff, 0xff, 0xff); + CGDrawInRegion(panicBack, UIAccessibilty::The().Height(), UIAccessibilty::The().Width(), 0, 0); auto start_y = 10; - auto x = 10; + auto x = 10; - cg_write_text("*** Kernel panic! ***\rnewoskrnl.dll stopped working properly so we had to shut it down.", start_y, x, panicTxt); + cg_write_text("newoskrnl.dll stopped working properly so we had to stop.", start_y, x, panicTxt); CGFini(); // Show the QR code now. - constexpr auto cVer = 4; - const auto cECC = qr::Ecc::H; - const auto cInput = cWebsiteMacro; - const auto cInputLen = rt_string_len(cWebsiteMacro); + constexpr auto cVer = 4; + const auto cECC = qr::Ecc::H; + const auto cInput = cWebsiteMacro; + const auto cInputLen = rt_string_len(cWebsiteMacro); - qr::Qr<cVer> encoder; - qr::QrDelegate encoderDelegate; + qr::Qr<cVer> encoder; + qr::QrDelegate encoderDelegate; encoder.encode(cInput, cInputLen, cECC, 0); // Manual mask 0 @@ -61,85 +61,68 @@ namespace Kernel // tell delegate to draw encoded QR now. encoderDelegate.draw<cVer>(encoder, cWhereStartX, - cWhereStartY); - - // ******* // - // shows in debug only. - // ******* // + cWhereStartY); - kcout << "*** STOP *** \r"; - kcout << "*** Kernel has trigerred a runtime stop. *** \r"; + start_y += 10; switch (id) { case RUNTIME_CHECK_PROCESS: { - kcout << "*** CAUSE: RUNTIME_CHECK_PROCESS *** \r"; - kcout << "*** WHAT: BAD DRIVER. *** \r"; + cg_write_text("Scheduler error.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_ACPI: { - kcout << "*** CAUSE: RUNTIME_CHECK_ACPI *** \r"; - kcout << "*** WHAT: ACPI ERROR, UNSTABLE STATE. *** \r"; + cg_write_text("ACPI error.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_POINTER: { - kcout << "*** CAUSE: RUNTIME_CHECK_POINTER *** \r"; - kcout << "*** WHAT: HEAP CRC32 ERROR, UNSTABLE STATE. *** \r"; + cg_write_text("Kernel heap error.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_BAD_BEHAVIOR: { - kcout << "*** CAUSE: RUNTIME_CHECK_BAD_BEHAVIOR *** \r"; - kcout << "*** WHAT: KERNEL BECAME UNSTABLE. *** \r"; + cg_write_text("Undefined Behavior error.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_BOOTSTRAP: { - kcout << "*** CAUSE: RUNTIME_CHECK_BOOTSTRAP *** \r"; - kcout << "*** WHAT: END OF CODE. *** \r"; + cg_write_text("End of code.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_HANDSHAKE: { - kcout << "*** CAUSE: RUNTIME_CHECK_HANDSHAKE *** \r"; - kcout << "*** WHAT: BAD HANDSHAKE. *** \r"; + cg_write_text("Handshake error.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_IPC: { - kcout << "*** CAUSE: RUNTIME_CHECK_IPC *** \r"; - kcout << "*** WHAT: RICH CALL VIOLATION. *** \r"; + cg_write_text("Kernel IPC error.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_INVALID_PRIVILEGE: { - kcout << "*** CAUSE: RUNTIME_CHECK_INVALID_PRIVILEGE *** \r"; - kcout << "*** WHAT: HYPERVISOR POLICY VIOLATION. *** \r"; + cg_write_text("Privilege violation.", start_y, x, panicTxt); break; case RUNTIME_CHECK_UNEXCPECTED: { - kcout << "*** CAUSE: RUNTIME_CHECK_UNEXCPECTED *** \r"; - kcout << "*** WHAT: CATASROPHIC FAILURE! *** \r"; + cg_write_text("Catasrophic failure.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_FAILED: { - kcout << "*** CAUSE: RUNTIME_CHECK_FAILED *** \r"; - kcout << "*** WHAT: ASSERTION FAILED! *** \r"; + cg_write_text("Assertion failed.", start_y, x, panicTxt); break; } default: { - kcout << "*** CAUSE: RUNTIME_CHECK_GENERIC *** \r"; + cg_write_text("Unknown error.", start_y, x, panicTxt); break; } } }; RecoveryFactory::Recover(); - } - + Void RecoveryFactory::Recover() noexcept - { + { while (true) { - asm volatile ("cli; hlt"); + asm volatile("cli; hlt"); } } - void ke_runtime_check(bool expr, const char* file, const char* line) { |
