diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-06 11:30:56 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-06 11:30:56 +0100 |
| commit | 61492dc648412818e1f0e96dbc9522514b1fed2a (patch) | |
| tree | 068fd8cca5e27cbe48990dae2e10cc618e6ae155 /Private/NewBoot/Source/FileReader.cxx | |
| parent | 55eb89dde91318a6b7f37e824d383e0625cd53f1 (diff) | |
HCR-15 : Load kernel into memory.
Progess have been done regarding PE/MZ support, also updated PEF impl to
not rely on compiler feature __attribute__
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/Source/FileReader.cxx')
| -rw-r--r-- | Private/NewBoot/Source/FileReader.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Private/NewBoot/Source/FileReader.cxx b/Private/NewBoot/Source/FileReader.cxx index efd53020..2bed60ef 100644 --- a/Private/NewBoot/Source/FileReader.cxx +++ b/Private/NewBoot/Source/FileReader.cxx @@ -92,10 +92,6 @@ BFileReader::BFileReader(const CharacterType* path, EfiHandlePtr ImageHandle) { } BFileReader::~BFileReader() { - if (this->mBlob) { - BS->FreePool(this->mBlob); - } - if (this->mFile) { this->mFile->Close(this->mFile); this->mFile = nullptr; @@ -115,17 +111,21 @@ Void BFileReader::ReadAll() { /// Allocate Handover page. - UInt8* blob = (UInt8*)kHandoverStartKernel; + if (mBlob == nullptr) { + UInt8* blob = (UInt8*)kHandoverStartKernel; + + if (BS->AllocatePages(AllocateAnyPages, EfiLoaderData, 1, + (EfiPhysicalAddress*)&blob) != kEfiOk) { + EFI::RaiseHardError(L"HCoreLdr_PageError", L"Allocation error."); + } - if (BS->AllocatePages(AllocateAnyPages, EfiLoaderData, 1, - (EfiPhysicalAddress*)&blob) != kEfiOk) { - EFI::RaiseHardError(L"HCoreLdr_PageError", L"Allocation error."); + mBlob = blob; } - mBlob = blob; - mSizeFile = KIB(kMaxReadSize); + mErrorCode = kNotSupported; - if (mFile->Read(mFile, &mSizeFile, mBlob) != kEfiOk) return; + if (mFile->Read(mFile, &mSizeFile, (VoidPtr)((UIntPtr)mBlob)) != kEfiOk) + return; mErrorCode = kOperationOkay; } |
