From eb076dbf3754f44efdda926e1cc55a5c86136f5c Mon Sep 17 00:00:00 2001 From: Amlal EL Mahrouss Date: Sun, 7 Jul 2024 09:39:07 +0200 Subject: MHR-36: IMP: Add ProgramLoader class, *_cast macros and patching capability. FIX: Device constructor marked as explicit. Signed-off-by: Amlal EL Mahrouss --- Boot/BootKit/BootKit.hxx | 1 + Boot/BootKit/Device.hxx | 2 +- Boot/BootKit/ProgramLoader.hxx | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Boot/BootKit/ProgramLoader.hxx (limited to 'Boot/BootKit') diff --git a/Boot/BootKit/BootKit.hxx b/Boot/BootKit/BootKit.hxx index c83b3c63..850f3896 100644 --- a/Boot/BootKit/BootKit.hxx +++ b/Boot/BootKit/BootKit.hxx @@ -135,6 +135,7 @@ private: BTextWriter mWriter; EfiFileProtocol* mFile{nullptr}; UInt64 mSizeFile{0}; + EfiFileProtocol* mRootFs; }; typedef UInt8* BlobType; diff --git a/Boot/BootKit/Device.hxx b/Boot/BootKit/Device.hxx index 234ab6bd..2c6ddd6b 100644 --- a/Boot/BootKit/Device.hxx +++ b/Boot/BootKit/Device.hxx @@ -14,7 +14,7 @@ using namespace Kernel; class Device { public: - Device() = default; + explicit Device() = default; virtual ~Device() = default; NEWOS_MOVE_DEFAULT(Device); diff --git a/Boot/BootKit/ProgramLoader.hxx b/Boot/BootKit/ProgramLoader.hxx new file mode 100644 index 00000000..9e14710c --- /dev/null +++ b/Boot/BootKit/ProgramLoader.hxx @@ -0,0 +1,41 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include +#include +#include + +namespace Boot +{ + using namespace Kernel; + + class ProgramLoader; + + /// @brief Program loader class + /// @package nl.zeta.boot.api + class ProgramLoader final + { + public: + explicit ProgramLoader() = delete; + ~ProgramLoader() = default; + + explicit ProgramLoader(Kernel::VoidPtr blob); + + ProgramLoader& operator=(const ProgramLoader&) = default; + ProgramLoader(const ProgramLoader&) = default; + + void Start(HEL::HandoverInformationHeader* handover); + const char* GetName(); + void SetName(const char* name); + + private: + Char fBlobName[255]; + VoidPtr fStartAddress{nullptr}; + VoidPtr fBlob{nullptr}; + }; +} // namespace Kernel \ No newline at end of file -- cgit v1.2.3