From 58ec3282634ccf75006043017ceacffed9a4533c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 23 Aug 2024 15:26:33 +0200 Subject: [IMP] BootScr module, manage boot driver (TODO need a UI toolkit for it) [IMP] Made NetBoot compilable as well. [IMP] Fix Thread loader to be able to load other executables. [REFACTOR] __NEWOS_ to __ZKA_ refactor. [WIP] Fixing catalog which can't be fetched again after being written. Signed-off-by: Amlal El Mahrouss --- dev/ZBA/Sources/Thread.cxx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'dev/ZBA/Sources/Thread.cxx') diff --git a/dev/ZBA/Sources/Thread.cxx b/dev/ZBA/Sources/Thread.cxx index c13d25b9..7362e484 100644 --- a/dev/ZBA/Sources/Thread.cxx +++ b/dev/ZBA/Sources/Thread.cxx @@ -15,13 +15,10 @@ #include #include -EXTERN_C -{ +EXTERN_C{ #include } -#define kHOTypeKernel 100 - EXTERN EfiBootServices* BS; namespace Boot @@ -53,13 +50,13 @@ namespace Boot return; } - if (optHdr->mSubsystem != kNewOSSubsystem) + if (optHdr->mSubsystem != kZKASubsystem) { - writer.Write("newosldr: Not a New OS executable.\r"); + writer.Write("newosldr: Not a ZKA Subsystem executable.\r"); return; } - writer.Write("newosldr: PE32+ executable detected (New OS Subsystem).\r"); + writer.Write("newosldr: PE32+ executable detected (ZKA Subsystem).\r"); auto numSecs = hdrPtr->mNumberOfSections; @@ -83,7 +80,7 @@ namespace Boot constexpr auto sectionForCode = ".text"; constexpr auto sectionForNewLdr = ".ldr"; - constexpr auto sectionForBSS = ".bss"; + constexpr auto sectionForBSS = ".bss"; for (SizeT sectIndex = 0; sectIndex < numSecs; ++sectIndex) { @@ -92,7 +89,7 @@ namespace Boot if (StrCmp(sectionForCode, sect->mName) == 0) { fStartAddress = (VoidPtr)((UIntPtr)loadStartAddress + optHdr->mAddressOfEntryPoint); - writer.Write("newosldr: Start Address: ").Write((UIntPtr)fStartAddress).Write("\r"); + writer.Write("newosldr: Entrypoint of DLL: ").Write((UIntPtr)fStartAddress).Write("\r"); } else if (StrCmp(sectionForBSS, sect->mName) == 0) { @@ -106,11 +103,11 @@ namespace Boot UInt32 HandoverType; }* structHandover = (struct HANDOVER_INFORMATION_STUB*)((UIntPtr)fBlob + sect->mPointerToRawData); - if (structHandover->HandoverMagic != kHandoverMagic || - structHandover->HandoverType != kHOTypeKernel) + if (structHandover->HandoverMagic != kHandoverMagic && + structHandover->HandoverType != HEL::kTypeKernel) { - cg_write_text("NEWOSLDR: INVALID HANDOVER IMAGE! ABORTING...", 40, 10, RGB(0x00, 0x00, 0x00)); - EFI::Stop(); + writer.Write("newosldr: Entrypoint of SYS: ").Write((UIntPtr)fStartAddress).Write("\r"); + cg_write_text("NEWOSLDR: NOT AN HANDOVER IMAGE...", 40, 10, RGB(0xFF, 0xFF, 0xFF)); } } @@ -149,7 +146,7 @@ namespace Boot } HEL::HandoverProc err_fn = [](HEL::HandoverInformationHeader* rcx) -> void { - cg_write_text("NEWOSLDR: INVALID IMAGE! ABORTING...", 40, 10, RGB(0x00, 0x00, 0x00)); + cg_write_text("NEWOSLDR: INVALID IMAGE! ABORTING...", 50, 10, RGB(0xFF, 0xFF, 0xFF)); EFI::Stop(); }; @@ -159,7 +156,6 @@ namespace Boot } reinterpret_cast(fStartAddress)(handover); - err_fn(handover); } const Char* BThread::GetName() -- cgit v1.2.3