diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-15 19:13:29 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-15 19:13:29 +0100 |
| commit | 1c2f1e90396f2400fe576c451a26a38891dd6c1a (patch) | |
| tree | d464b841cc000e5fbf4fb69f666d5e6fac67e7a1 | |
| parent | f323b1049bb581403d903f95224c0476b1812d43 (diff) | |
HCR-18: Will load the CodeManager preferred format, PEF.
- PEF is the de facto format for HCore.
- PEF is compiled using the Amlal El Mahrouss Object Format.
- PEF is big-endian by default.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
| -rw-r--r-- | Private/EFIKit/Handover.hxx | 2 | ||||
| -rw-r--r-- | Private/NewBoot/Source/RuntimeMain.cxx | 39 |
2 files changed, 12 insertions, 29 deletions
diff --git a/Private/EFIKit/Handover.hxx b/Private/EFIKit/Handover.hxx index f9b8044f..840af2ec 100644 --- a/Private/EFIKit/Handover.hxx +++ b/Private/EFIKit/Handover.hxx @@ -73,8 +73,6 @@ struct HandoverInformationHeader { voidPtr f_RTC; voidPtr f_GOP; SizeT f_GOPSize; - SizeT f_HeapCommitSize; - SizeT f_StackCommitSize; }; /** diff --git a/Private/NewBoot/Source/RuntimeMain.cxx b/Private/NewBoot/Source/RuntimeMain.cxx index 4388d8f5..78e73db2 100644 --- a/Private/NewBoot/Source/RuntimeMain.cxx +++ b/Private/NewBoot/Source/RuntimeMain.cxx @@ -68,45 +68,33 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, ExecOptionalHeaderPtr optHdr = reinterpret_cast<ExecOptionalHeaderPtr>( ptrHdr + sizeof(ExecHeader)); - UInt64 baseSec = ptrHdr->mNumberOfSections; - img.File()->SetPosition(img.File(), &baseSec); - - baseSec = ptrHdr->mNumberOfSections; - ExecSectionHeaderPtr headers = - (ExecSectionHeaderPtr)(&ptrHdr->mCharacteristics + 1); - - EfiPhysicalAddress base = optHdr->mImageBase + optHdr->mBaseOfData; - BS->AllocatePages(AllocateAddress, EfiLoaderCode, 1, &base); - - UInt64 codeSz = optHdr->mSizeOfCode; - img.File()->Read(img.File(), &codeSz, (VoidPtr)&base); - - // TODO ExecReader class - UInt32 MapKey = 0; - UInt32* Size = 0; - EfiMemoryDescriptor* Descriptor = nullptr; + UInt32* Size; + EfiMemoryDescriptor* Descriptor; UInt32 SzDesc = 0; UInt32 RevDesc = 0; if (BS->AllocatePool(EfiLoaderData, sizeof(UInt64), (VoidPtr*)&Size) != kEfiOk) { - EFI::RaiseHardError(L"HCoreLdr-BadAlloc", - L"Bad Alloc! (AllocatePool)"); + EFI::RaiseHardError( + L"HCoreLdr-BadAlloc", + L"The bootloader ran out of memory! Please check your specs."); } *Size = sizeof(EfiMemoryDescriptor); if (BS->AllocatePool(EfiLoaderData, sizeof(EfiMemoryDescriptor), (VoidPtr*)&Descriptor) != kEfiOk) { - EFI::RaiseHardError(L"HCoreLdr-BadAlloc", - L"Bad Alloc! (AllocatePool)"); + EFI::RaiseHardError( + L"HCoreLdr-BadAlloc", + L"The bootloader ran out of memory! Please check your specs."); } if (BS->GetMemoryMap(Size, Descriptor, &MapKey, &SzDesc, &RevDesc) != kEfiOk) { - EFI::RaiseHardError(L"HCoreLdr-BadAlloc", - L"Bad Alloc! (GetMemoryMap)"); + EFI::RaiseHardError( + L"HCoreLdr-GetMemoryMap", + L"GetMemoryMap returned a value which isn't kEfiOk!"); } HEL::HandoverInformationHeader* handoverHdrPtr = nullptr; @@ -134,10 +122,7 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, SystemTable->FirmwareVendor, handoverHdrPtr->f_FirmwareVendorLen); - handoverHdrPtr->f_HeapCommitSize = optHdr->mSizeOfHeapCommit; - handoverHdrPtr->f_StackCommitSize = optHdr->mSizeOfStackCommit; - - writer.WriteString(L"HCoreLdr: Exit...\r\n"); + writer.WriteString(L"HCoreLdr: Leaving it to kernel...\r\n"); EFI::ExitBootServices(MapKey, ImageHandle); |
