diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-07-12 04:28:12 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-07-12 04:28:12 +0200 |
| commit | c0d80471813628dbedd68f45f14b3b7b85d12f8b (patch) | |
| tree | a5b99c3253c0f49ca4e97b30e7f9e3d79235dce9 /Boot/Sources | |
| parent | a268a7d3551523fb82b1495808f3ea2516b6fdaa (diff) | |
[IMP]
- Guessing the file size on BFileReader's UEFI implementation.
- Use kib_cast(4) instead of 4096 directly.
- Better resolution, and probing it now.
- Better ProgramLoader class.
- Better description for Filesystem manager.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Boot/Sources')
| -rw-r--r-- | Boot/Sources/HEL/AMD64/BootFileReader.cxx | 15 | ||||
| -rw-r--r-- | Boot/Sources/HEL/AMD64/BootMain.cxx | 24 | ||||
| -rw-r--r-- | Boot/Sources/ProgramLoader.cxx | 3 |
3 files changed, 28 insertions, 14 deletions
diff --git a/Boot/Sources/HEL/AMD64/BootFileReader.cxx b/Boot/Sources/HEL/AMD64/BootFileReader.cxx index a9ea6d3f..f784bf6f 100644 --- a/Boot/Sources/HEL/AMD64/BootFileReader.cxx +++ b/Boot/Sources/HEL/AMD64/BootFileReader.cxx @@ -127,6 +127,21 @@ Void BFileReader::ReadAll(SizeT readUntil, SizeT chunkToRead) { if (mBlob == nullptr) { + EfiFileInfo newPtrInfo; + UInt32 szInfo = 0; + + EfiGUID cFileInfoGUID = EFI_FILE_INFO_GUID; + + if (mFile->GetInfo(mFile, &cFileInfoGUID, &szInfo, &newPtrInfo) == kEfiOk) + { + if (newPtrInfo.FileSize < readUntil) + readUntil = newPtrInfo.FileSize; + else if (readUntil < 1) + readUntil = newPtrInfo.FileSize; + + mWriter.Write(L"newosldr: physical size: ").Write(readUntil).Write("\r"); + } + if (auto err = BS->AllocatePool(EfiLoaderCode, readUntil, (VoidPtr*)&mBlob) != kEfiOk) { diff --git a/Boot/Sources/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx index 5425f1e1..76a35843 100644 --- a/Boot/Sources/HEL/AMD64/BootMain.cxx +++ b/Boot/Sources/HEL/AMD64/BootMain.cxx @@ -25,11 +25,11 @@ #endif // !kMachineModel #ifndef cExpectedWidth -#define cExpectedWidth 436 +#define cExpectedWidth 1280 #endif #ifndef cExpectedHeight -#define cExpectedHeight 644 +#define cExpectedHeight 720 #endif /** Graphics related. */ @@ -53,9 +53,14 @@ STATIC Void InitVideoFB() noexcept BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*)&kGop); - for (size_t i = 0; i < kGop->Mode->MaxMode; ++i) + kStride = 4; + + for (SizeT i = 0; i < kGop->Mode->MaxMode; ++i) { EfiGraphicsOutputProtocolModeInformation* infoPtr = nullptr; + UInt32 sz = 0U; + + kGop->QueryMode(kGop, i, &sz, &infoPtr); if (infoPtr->HorizontalResolution == cExpectedWidth && infoPtr->VerticalResolution == cExpectedHeight) @@ -65,7 +70,6 @@ STATIC Void InitVideoFB() noexcept } } - kStride = 4; } /// @brief check the BootDevice if suitable. @@ -126,7 +130,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, vendorTable[4] == 'P' && vendorTable[5] == 'T' && vendorTable[6] == 'R' && vendorTable[7] == ' ') { - writer.Write(L"newosldr: Found ACPI RSD PTR!\r"); + writer.Write(L"newosldr: filling rsdptr...\r"); handoverHdrPtr->f_HardwareTables.f_RsdPtr = (VoidPtr)vendorTable; break; @@ -230,16 +234,14 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, BFileReader readerKernel(L"newoskrnl.exe", ImageHandle); - /// TODO: BFileReader::GetSize(...); - constexpr auto cKernelSz = 275101; - readerKernel.ReadAll(cKernelSz, 4096); + readerKernel.ReadAll(0); Boot::ProgramLoader* loader = nullptr; if (readerKernel.Blob()) { loader = new Boot::ProgramLoader(readerKernel.Blob()); - loader->SetName("'newoskrnl.exe'"); + loader->SetName("\"newoskrnl.exe\" (ZKA)"); } #endif // ifdef __NEWOS_OTA__ @@ -247,11 +249,9 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, EFI::ExitBootServices(*MapKey, ImageHandle); // ---------------------------------------------------- // - // Fallback to builtin kernel. - // + // Call OTA kernel or fallback to builtin. // ---------------------------------------------------- // #ifdef __NEWOS_OTA__ - if (loader) loader->Start(handoverHdrPtr); #endif // ifdef __NEWOS_OTA__ diff --git a/Boot/Sources/ProgramLoader.cxx b/Boot/Sources/ProgramLoader.cxx index 41bade3d..b88f4384 100644 --- a/Boot/Sources/ProgramLoader.cxx +++ b/Boot/Sources/ProgramLoader.cxx @@ -49,8 +49,7 @@ namespace Boot } else { - // probably a binary blob. - fStartAddress = fBlob; + writer.Write("newosldr: Exec format error.\r"); } } |
