From eb5271c14e02aab956ab53f5e74290bca495e2ff Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 28 Dec 2024 05:03:47 +0100 Subject: See details of commit. IMPL: Better Bootloader architecture. FIX: Remove overcomplicated FbMgr code. IMPL: Implement the SwapMgrDisk function to dump process data to disk. FIX: Fix the format system in Boot. Signed-off-by: Amlal El Mahrouss --- dev/Boot/Mod/SysChk/Module.cc | 27 ++++++--------------------- dev/Boot/Mod/SysChk/build.json | 3 ++- dev/Boot/amd64-efi.make | 2 +- dev/Boot/src/HEL/AMD64/.gitkeep | 0 dev/Boot/src/HEL/AMD64/BootMain.cc | 9 ++++----- dev/Boot/src/HEL/ARM64/BootMain.cc | 4 ++-- 6 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 dev/Boot/src/HEL/AMD64/.gitkeep (limited to 'dev/Boot') diff --git a/dev/Boot/Mod/SysChk/Module.cc b/dev/Boot/Mod/SysChk/Module.cc index a48e524c..e51eabef 100644 --- a/dev/Boot/Mod/SysChk/Module.cc +++ b/dev/Boot/Mod/SysChk/Module.cc @@ -21,27 +21,12 @@ #include #include -EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* Handover) +EXTERN_C Int32 ModuleMain(Kernel::HEL::BootInfoHeader* handover) { - EfiSystemTable* system_table = (EfiSystemTable*)Handover->f_FirmwareCustomTables[1]; + if (!handover) + return kEfiFail; - EfiInputKey key{}; - - system_table->ConIn->ReadKeyStroke(system_table->ConIn, &key); - - if (key.UnicodeChar == 'F' || - key.UnicodeChar == 'f') - { - UI::ui_draw_background(); - - fb_init(); - - FBDrawBitMapInRegion(zka_no_disk, ZKA_NO_DISK_HEIGHT, ZKA_NO_DISK_WIDTH, (kHandoverHeader->f_GOP.f_Width - ZKA_NO_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - ZKA_NO_DISK_HEIGHT) / 2); - - fb_fini(); - - return kEfiOk; - } - - return kEfiFail; + Boot::BDiskFormatFactory partition_factory; + + return !partition_factory.IsPartitionValid() ? kEfiOk : kEfiFail; } diff --git a/dev/Boot/Mod/SysChk/build.json b/dev/Boot/Mod/SysChk/build.json index cd21e269..2c079889 100644 --- a/dev/Boot/Mod/SysChk/build.json +++ b/dev/Boot/Mod/SysChk/build.json @@ -2,7 +2,7 @@ "compiler_path": "x86_64-w64-mingw32-g++", "compiler_std": "c++20", "headers_path": ["../", "../../", "../../../Kernel", "../../../", "./"], - "sources_path": ["*.cc", "*.S"], + "sources_path": ["*.cc", "*.S", "../../src/HEL/AMD64/*.cc", "../../src/HEL/AMD64/*.S", "../../src/*.cc"], "output_name": "syschk.sys", "compiler_flags": [ "-ffreestanding", @@ -16,6 +16,7 @@ "cpp_macros": [ "__MINOSKRNL__", "__ZBAOSLDR__", + "__BOOTLDR_STANDALONE__", "__ZKA_AMD64__", "kChkVersionHighest=0x0100", "kChkVersionLowest=0x0100", diff --git a/dev/Boot/amd64-efi.make b/dev/Boot/amd64-efi.make index 3ffffee1..c9d04e7a 100644 --- a/dev/Boot/amd64-efi.make +++ b/dev/Boot/amd64-efi.make @@ -21,7 +21,7 @@ EMU=qemu-system-x86_64 -net none endif ifeq ($(NEWS_MODEL), ) -ZKA_MODEL=-DkMachineModel="\"ZKA\"" +ZKA_MODEL=-DkMachineModel="\"ZkaOS\"" endif BIOS=OVMF.fd diff --git a/dev/Boot/src/HEL/AMD64/.gitkeep b/dev/Boot/src/HEL/AMD64/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/dev/Boot/src/HEL/AMD64/BootMain.cc b/dev/Boot/src/HEL/AMD64/BootMain.cc index 29238413..4609a1d3 100644 --- a/dev/Boot/src/HEL/AMD64/BootMain.cc +++ b/dev/Boot/src/HEL/AMD64/BootMain.cc @@ -147,7 +147,7 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr ImageHandle, FBDrawBitMapInRegion(zka_disk, ZKA_DISK_HEIGHT, ZKA_DISK_WIDTH, (kHandoverHeader->f_GOP.f_Width - ZKA_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - ZKA_DISK_HEIGHT) / 2); - fb_fini(); + fb_clear(); UInt32 cnt_enabled = 0; UInt32 cnt_disabled = 0; @@ -220,8 +220,7 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr ImageHandle, Boot::BDiskFormatFactory partition_factory; - if (partition_factory.IsPartitionValid() == false && - syschk_thread->Start(handover_hdr, NO) == kEfiOk) + if (syschk_thread->Start(handover_hdr, NO) != kEfiOk) { fb_init(); @@ -232,13 +231,13 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr ImageHandle, root.fKind = kNeFSCatalogKindDir; - partition_factory.Format("Zka HD", &root, 1); + partition_factory.Format(kMachineModel " HD", &root, 1); UI::ui_draw_background(); FBDrawBitMapInRegion(zka_has_disk, ZKA_HAS_DISK_HEIGHT, ZKA_HAS_DISK_WIDTH, (kHandoverHeader->f_GOP.f_Width - ZKA_HAS_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - ZKA_HAS_DISK_HEIGHT) / 2); - fb_fini(); + fb_clear(); } // ------------------------------------------ // diff --git a/dev/Boot/src/HEL/ARM64/BootMain.cc b/dev/Boot/src/HEL/ARM64/BootMain.cc index fe35ea1b..254301a5 100644 --- a/dev/Boot/src/HEL/ARM64/BootMain.cc +++ b/dev/Boot/src/HEL/ARM64/BootMain.cc @@ -10,11 +10,11 @@ #include #ifndef kExpectedWidth -#define kExpectedWidth 844 +#define kExpectedWidth (1280) #endif #ifndef kExpectedHeight -#define kExpectedHeight 390 +#define kExpectedHeight (720) #endif EXTERN EfiBootServices* BS; -- cgit v1.2.3