diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-05 14:50:32 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-05 14:50:32 +0200 |
| commit | a974f2b8861bfd60613d1bf441f77a5aa0c6f76a (patch) | |
| tree | 19ef849b3d1bb785519a7998f13ceb0e30b0b079 /Kernel | |
| parent | cc03f40d9fb1d68bfd945284a3ff5067dfd8475a (diff) | |
[IMP] QR code on ke_stop screen instead of bootscreen.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel')
| -rw-r--r-- | Kernel/FirmwareKit/EFI/API.hxx | 23 | ||||
| -rw-r--r-- | Kernel/HALKit/POWER/Hart.hxx | 8 | ||||
| -rw-r--r-- | Kernel/Sources/KernelCheck.cxx | 38 | ||||
| -rw-r--r-- | Kernel/Sources/Utils.cxx | 5 | ||||
| -rw-r--r-- | Kernel/amd64-efi.make | 4 |
5 files changed, 40 insertions, 38 deletions
diff --git a/Kernel/FirmwareKit/EFI/API.hxx b/Kernel/FirmwareKit/EFI/API.hxx index 2883ee13..1466bdd1 100644 --- a/Kernel/FirmwareKit/EFI/API.hxx +++ b/Kernel/FirmwareKit/EFI/API.hxx @@ -16,8 +16,6 @@ // forward decl. class BTextWriter; -#define cWebsiteMacro "https://zka-tech.nl/hulp" - #define __BOOTKIT_NO_INCLUDE__ 1 #include <BootKit/BootKit.hxx> @@ -88,28 +86,7 @@ Bascially frees everything we have in the EFI side. ST->ConOut->OutputString(ST->ConOut, L" ***\r"); -#ifdef __NEWOSLDR__ - // Show the QR code now. - - constexpr auto cVer = 4; - const auto cECC = qr::Ecc::H; - const auto cInput = cWebsiteMacro; - const auto cInputLen = StrLen(cWebsiteMacro); - - qr::Qr<cVer> encoder; - qr::QrDelegate encoderDelegate; - - encoder.encode(cInput, cInputLen, cECC, 0); // Manual mask 0 - - const auto cWhereStartX = (kHandoverHeader->f_GOP.f_Width - encoder.side_size()) - 20; - const auto cWhereStartY = (kHandoverHeader->f_GOP.f_Height - encoder.side_size()) / 2; - - // tell delegate to draw encoded QR now. - encoderDelegate.draw<cVer>(encoder, cWhereStartX, - cWhereStartY); - EFI::Stop(); -#endif // ifdef __NEWOSLDR__ } } // namespace EFI diff --git a/Kernel/HALKit/POWER/Hart.hxx b/Kernel/HALKit/POWER/Hart.hxx index a6000953..4839260c 100644 --- a/Kernel/HALKit/POWER/Hart.hxx +++ b/Kernel/HALKit/POWER/Hart.hxx @@ -15,20 +15,22 @@ #include <NewKit/Defines.hxx> +struct HAL_HARDWARE_THREAD; + /// @brief hardware thread indentification type. typedef Kernel::Int32 PPCHartType; /// @brief Hardware thread information structure. -typedef struct HalHardwareThread +typedef struct HAL_HARDWARE_THREAD { Kernel::UIntPtr fStartAddress; Kernel::UInt8 fPrivleged : 1; Kernel::UInt32 fPageFlags; PPCHartType fIdentNumber; -} HalHardwareThread; +} HAL_HARDWARE_THREAD; /// @brief Set PC to specific hart. /// @param hart the hart /// @param epc the pc. /// @return -EXTERN_C Kernel::Void hal_set_pc_to_hart(HalHardwareThread* hart, Kernel::VoidPtr epc); +EXTERN_C Kernel::Void hal_set_pc_to_hart(HAL_HARDWARE_THREAD* hart, Kernel::VoidPtr epc); diff --git a/Kernel/Sources/KernelCheck.cxx b/Kernel/Sources/KernelCheck.cxx index 900bbf6e..0fcc742f 100644 --- a/Kernel/Sources/KernelCheck.cxx +++ b/Kernel/Sources/KernelCheck.cxx @@ -15,14 +15,17 @@ #include <Modules/CoreCG/FbRenderer.hxx> #include <Modules/CoreCG/TextRenderer.hxx> -EXTERN_C Kernel::Void ke_wait_for_debugger() -{ +#define SetMem(dst, byte, sz) Kernel::rt_set_memory((Kernel::VoidPtr)dst, byte, sz) +#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) -} +#include <BootKit/Vendor/Qr.hxx> /* Each error code is attributed with an ID, which will prompt a string onto the * screen. Wait for debugger... */ +#define cWebsiteMacro "https://zka-tech.nl/hulp" + namespace Kernel { void ke_stop(const Kernel::Int& id) @@ -37,10 +40,29 @@ namespace Kernel auto start_y = 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("*** Kernel panic! ***\rnewoskrnl.lib stopped working properly so we had to shut it down.", 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); + + qr::Qr<cVer> encoder; + qr::QrDelegate encoderDelegate; + + encoder.encode(cInput, cInputLen, cECC, 0); // Manual mask 0 + + const auto cWhereStartX = (kHandoverHeader->f_GOP.f_Width - encoder.side_size()) - 20; + const auto cWhereStartY = (kHandoverHeader->f_GOP.f_Height - encoder.side_size()) / 2; + + // tell delegate to draw encoded QR now. + encoderDelegate.draw<cVer>(encoder, cWhereStartX, + cWhereStartY); + // ******* // // shows in debug only. // ******* // @@ -112,10 +134,6 @@ namespace Kernel Void RecoveryFactory::Recover() noexcept { -#ifdef __DEBUG__ - ke_wait_for_debugger(); -#endif // ifdef __DEBUG__ - PowerFactoryInterface powerInterface(kHandoverHeader->f_HardwareTables.f_VendorPtr); powerInterface.Shutdown(); } @@ -126,8 +144,8 @@ namespace Kernel if (!expr) { #ifdef __DEBUG__ - kcout << "newoskrnl: File: " << file << "\r"; - kcout << "newoskrnl: Line: " << line << "\r"; + kcout << "newoskrnl: FILE: " << file << "\r"; + kcout << "newoskrnl: LINE: " << line << "\r"; #endif // __DEBUG__ diff --git a/Kernel/Sources/Utils.cxx b/Kernel/Sources/Utils.cxx index 6eaa7757..a8b3f00a 100644 --- a/Kernel/Sources/Utils.cxx +++ b/Kernel/Sources/Utils.cxx @@ -66,6 +66,7 @@ namespace Kernel { if (!src || len < 1) return nullptr; + char* start = reinterpret_cast<Char*>(src); while (len) @@ -210,6 +211,8 @@ namespace Kernel } } // namespace Kernel +#ifdef __FREESTANDING__ + //////////////////////////////////////////////////////////////////////////////////////// /// Exported C functions //////////////////////////////////////////////////////////////////////////////////////// @@ -250,3 +253,5 @@ EXTERN_C Kernel::SizeT strcmp(char* dst, char* src, Kernel::SizeT len) { return Kernel::rt_string_cmp(src, dst, len); } + +#endif // __FREESTANDING__
\ No newline at end of file diff --git a/Kernel/amd64-efi.make b/Kernel/amd64-efi.make index ce9bcd90..e233ebdc 100644 --- a/Kernel/amd64-efi.make +++ b/Kernel/amd64-efi.make @@ -5,9 +5,9 @@ CC = x86_64-w64-mingw32-g++ LD = x86_64-w64-mingw32-ld -CCFLAGS = -fshort-wchar -c -ffreestanding -shared -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \ +CCFLAGS = -fshort-wchar -c -shared -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \ -std=c++20 -D__NEWOS_SUPPORT_NX__ -I../Vendor -D__FSKIT_USE_NEWFS__ \ - -D__NEWOSKRNL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I./ -I../ + -D__NEWOSKRNL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I./ -I../ -I../Boot ASM = nasm |
