diff options
| author | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-13 20:29:28 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlalelmahrouss@icloud.com> | 2024-02-13 20:29:28 +0100 |
| commit | 9b2686756dee0e55b7860e7ea18d4bf92a365065 (patch) | |
| tree | cbfbfdf508d2e1634c4f1a5ae841600d589bffcf /Private/EFIKit | |
| parent | 544d0cadfc371bcfb54d9f7ec15464bc6a79af21 (diff) | |
HCR-18: First commit, bringing HCoreKrnl.exe into memory.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/EFIKit')
| -rw-r--r-- | Private/EFIKit/Api.hxx | 7 | ||||
| -rw-r--r-- | Private/EFIKit/EFI.hxx | 9 | ||||
| -rw-r--r-- | Private/EFIKit/Handover.hxx | 8 |
3 files changed, 18 insertions, 6 deletions
diff --git a/Private/EFIKit/Api.hxx b/Private/EFIKit/Api.hxx index 7338235a..e91e983d 100644 --- a/Private/EFIKit/Api.hxx +++ b/Private/EFIKit/Api.hxx @@ -11,6 +11,7 @@ #define __EFI_API__ #include <EFIKit/EFI.hxx> +#include <EFIKit/Handover.hxx> #include <KernelKit/MSDOS.hpp> #include <KernelKit/PE.hpp> @@ -27,7 +28,9 @@ Void Stop() noexcept; @brief Exit EFI API to let the OS load correctly. Bascially frees everything we have in the EFI side. */ -inline void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept { +inline void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle, + HEL::HandoverProc &handOver, + HEL::HandoverInformationHeader *hdr) noexcept { if (!ST) return; /// The MapKey may be invalid. @@ -35,6 +38,8 @@ inline void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept { if (ST->BootServices->ExitBootServices(ImageHandle, MapKey) != kEfiOk) { EFI::Stop(); } + + return handOver(hdr); } enum { diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx index dfaf68eb..3358da44 100644 --- a/Private/EFIKit/EFI.hxx +++ b/Private/EFIKit/EFI.hxx @@ -416,6 +416,11 @@ typedef UInt64(EFI_API *EfiAllocatePages)(EfiAllocateType AllocType, typedef UInt64(EFI_API *EfiFreePages)(EfiPhysicalAddress *Memory, UInt32 Pages); +typedef UInt64(EFI_API *EfiGetMemoryMap)(UInt64 *MapSize, + EfiMemoryDescriptor *DescPtr, + UInt64 *MapKey, UInt64 *DescSize, + UInt64 *DescVersion); + /** * @brief GUID type, something you can also find in CFKit. */ @@ -459,7 +464,7 @@ typedef struct EfiBootServices { UIntPtr RestoreTPL; EfiAllocatePages AllocatePages; EfiFreePages FreePages; - UIntPtr GetMemoryMap; + EfiGetMemoryMap GetMemoryMap; EfiAllocatePool AllocatePool; EfiFreePool FreePool; UIntPtr CreateEvent; @@ -720,4 +725,6 @@ struct EfiFileInfo final { #define EFI_FILE_PROTOCOL_REVISION2 0x00020000 #define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2 +#define EFI_EXTRA_DESCRIPTOR_SIZE 8 + #endif // ifndef __EFI__ diff --git a/Private/EFIKit/Handover.hxx b/Private/EFIKit/Handover.hxx index eb79e934..840af2ec 100644 --- a/Private/EFIKit/Handover.hxx +++ b/Private/EFIKit/Handover.hxx @@ -61,22 +61,22 @@ typedef struct HandoverHeader final { } __attribute__((packed)) HandoverHeader, *HandoverHeaderPtr; struct HandoverInformationHeader { - HandoverHeaderPtr f_Header; + HandoverHeader f_Header; voidPtr f_VirtualStart; SizeT f_VirtualSize; voidPtr f_PhysicalStart; SizeT f_PhysicalSize; - Char f_FirmwareVendorName[32]; + WideChar f_FirmwareVendorName[32]; SizeT f_FirmwareVendorLen; voidPtr f_RsdPtr; voidPtr f_SmBIOS; voidPtr f_RTC; voidPtr f_GOP; - voidPtr f_GOPSize; + SizeT f_GOPSize; }; /** @brief Handover Jump Proc */ -typedef UInt64 (*HandoverProc)(HandoverInformationHeader* pHandover); +typedef void (*HandoverProc)(HandoverInformationHeader* pHandover); } // namespace HCore::HEL |
