diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-08-24 08:51:21 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-08-24 08:54:22 +0200 |
| commit | 4185fcc698e237225902646736c6b23f6b5e54be (patch) | |
| tree | 7b0fc0bb58cb20c61e676b13e3e0f7fd52c73a56 /dev/ZBA/Sources | |
| parent | b31d81cd939ed3e8bb5fade029b32876e71ed54c (diff) | |
[IMP+REFACTORS] See below.
+ Add SysChk driver instead of BootScr.
+ Working on AHCI driver, did progress on detection, need to find out
why the signature are set to zero.
+ Refactor PE loader structures.
Add BecomeBusMaster call when probing AHCI disk.
+ Alongside some other modifications.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZBA/Sources')
| -rw-r--r-- | dev/ZBA/Sources/HEL/AMD64/BootMain.cxx | 10 | ||||
| -rw-r--r-- | dev/ZBA/Sources/Thread.cxx | 30 |
2 files changed, 13 insertions, 27 deletions
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx index c5ee3fb3..c98f700c 100644 --- a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx +++ b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx @@ -226,8 +226,8 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, // format the disk. // ---------------------------------------------------- // - BFileReader readerBootScr(L"bootscr.sys", ImageHandle); - readerBootScr.ReadAll(0); + BFileReader readerSysChk(L"syschk.sys", ImageHandle); + readerSysChk.ReadAll(0); Boot::BThread* loaderBootScr = nullptr; @@ -235,10 +235,10 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, // If we succeed in reading the blob, then execute it. // ------------------------------------------ // - if (readerBootScr.Blob()) + if (readerSysChk.Blob()) { - loaderBootScr = new Boot::BThread(readerBootScr.Blob()); - loaderBootScr->SetName("64-bit Boot Screen DLL."); + loaderBootScr = new Boot::BThread(readerSysChk.Blob()); + loaderBootScr->SetName("64-bit System Check DLL."); } loaderBootScr->Start(handoverHdrPtr); diff --git a/dev/ZBA/Sources/Thread.cxx b/dev/ZBA/Sources/Thread.cxx index 58937213..610d45b8 100644 --- a/dev/ZBA/Sources/Thread.cxx +++ b/dev/ZBA/Sources/Thread.cxx @@ -12,34 +12,20 @@ #include <KernelKit/PEF.hxx> #include <KernelKit/PE.hxx> #include <KernelKit/MSDOS.hxx> -#include <Modules/CoreCG/TextRenderer.hxx> #include <CFKit/LoaderUtils.hxx> +#include <Modules/CoreCG/TextRenderer.hxx> + +#include <SIGG/Drv.hxx> EXTERN_C{ #include <string.h> } -// External boot services record. +// External boot services symbol. EXTERN EfiBootServices* BS; namespace Boot { - namespace Detail - { - /// @brief Instablle Secure Driver record. - struct SIGNED_DRIVER_HEADER final - { - // doesn't change. - char d_binary_magic[5]; - int d_binary_version; - // can change. - char d_binary_name[4096]; - UInt64 d_binary_checksum; - UInt64 d_binary_size; - char d_binary_padding[512]; - }; - } // namespace Detail - BThread::BThread(VoidPtr blob) : fBlob(blob), fStartAddress(nullptr) { @@ -57,8 +43,8 @@ namespace Boot if (firstBytes[0] == kMagMz0 && firstBytes[1] == kMagMz1) { - ExecHeaderPtr hdrPtr = ldr_find_exec_header(firstBytes); - ExecOptionalHeaderPtr optHdr = ldr_find_opt_exec_header(firstBytes); + LDR_EXEC_HEADER_PTR hdrPtr = ldr_find_exec_header(firstBytes); + LDR_OPTIONAL_HEADER_PTR optHdr = ldr_find_opt_exec_header(firstBytes); if (hdrPtr->mMachine != kPeMachineAMD64 || hdrPtr->mSignature != kPeMagic) @@ -93,7 +79,7 @@ namespace Boot auto numPages = optHdr->mSizeOfImage / cPageSize; BS->AllocatePages(AllocateAddress, EfiLoaderData, numPages, &loadStartAddress); - ExecSectionHeaderPtr sectPtr = (ExecSectionHeaderPtr)(((Char*)optHdr) + hdrPtr->mSizeOfOptionalHeader); + LDR_SECTION_HEADER_PTR sectPtr = (LDR_SECTION_HEADER_PTR)(((Char*)optHdr) + hdrPtr->mSizeOfOptionalHeader); constexpr auto sectionForCode = ".text"; constexpr auto sectionForNewLdr = ".ldr"; @@ -101,7 +87,7 @@ namespace Boot for (SizeT sectIndex = 0; sectIndex < numSecs; ++sectIndex) { - ExecSectionHeaderPtr sect = §Ptr[sectIndex]; + LDR_SECTION_HEADER_PTR sect = §Ptr[sectIndex]; if (StrCmp(sectionForCode, sect->mName) == 0) { |
