From 03a0fee13445aeb95f01d64409e5304b8e97b31c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 26 Apr 2024 15:48:09 +0200 Subject: MHR-16: Fix NewBoot bug due to terrible code. Signed-off-by: Amlal El Mahrouss --- Private/FirmwareKit/EFI/API.hxx | 3 +-- Private/FirmwareKit/EFI/EFI.hxx | 10 +++++----- Private/FirmwareKit/Handover.hxx | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'Private/FirmwareKit') diff --git a/Private/FirmwareKit/EFI/API.hxx b/Private/FirmwareKit/EFI/API.hxx index 0e2ef200..4cf8e603 100644 --- a/Private/FirmwareKit/EFI/API.hxx +++ b/Private/FirmwareKit/EFI/API.hxx @@ -47,8 +47,7 @@ Bascially frees everything we have in the EFI side. inline void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept { if (!ST) return; - while (ST->BootServices->ExitBootServices(ImageHandle, MapKey) != kEfiOk) - ; + ST->BootServices->ExitBootServices(ImageHandle, MapKey); } enum { diff --git a/Private/FirmwareKit/EFI/EFI.hxx b/Private/FirmwareKit/EFI/EFI.hxx index 7f8223cf..c967647c 100644 --- a/Private/FirmwareKit/EFI/EFI.hxx +++ b/Private/FirmwareKit/EFI/EFI.hxx @@ -50,6 +50,9 @@ typedef struct EfiHandle { /* UEFI uses wide characters by default. */ typedef WideChar EfiCharType; +typedef UInt64 EfiPhysicalAddress; +typedef UIntPtr EfiVirtualAddress; + /// What's BootBolicy? /// If TRUE, indicates that the request originates from the boot manager, and /// that the boot manager is attempting to load FilePath as a boot selection. If @@ -200,13 +203,13 @@ typedef struct EfiMemoryDescriptor { /// 0xfffffffffffff000. Kind EFI_PHYSICAL_ADDRESS is defined in the /// AllocatePages() function description /// - UIntPtr PhysicalStart; + EfiPhysicalAddress PhysicalStart; /// /// Virtual address of the first byte in the memory region. /// VirtualStart must be aligned on a 4 KiB boundary, /// and must not be above 0xfffffffffffff000. /// - UIntPtr VirtualStart; + EfiVirtualAddress VirtualStart; /// /// NumberOfPagesNumber of 4 KiB pages in the memory region. /// NumberOfPages must not be 0, and must not be any value @@ -417,9 +420,6 @@ typedef struct EfiFileDevicePathProtocol { WideChar Path[kPathLen]; } EfiFileDevicePathProtocol; -typedef UInt64 EfiPhysicalAddress; -typedef UIntPtr EfiVirtualAddress; - typedef UInt64(EFI_API *EfiExitBootServices)(VoidPtr ImageHandle, UInt32 MapKey); diff --git a/Private/FirmwareKit/Handover.hxx b/Private/FirmwareKit/Handover.hxx index 4131467d..afec440d 100644 --- a/Private/FirmwareKit/Handover.hxx +++ b/Private/FirmwareKit/Handover.hxx @@ -64,7 +64,6 @@ struct HandoverInformationHeader { voidPtr f_VirtualStart; SizeT f_VirtualSize; voidPtr f_PhysicalStart; - SizeT f_PhysicalSize; WideChar f_FirmwareVendorName[32]; SizeT f_FirmwareVendorLen; struct { @@ -79,6 +78,7 @@ struct HandoverInformationHeader { UInt32 f_PixelFormat; UInt32 f_PixelPerLine; } f_GOP; + UInt64 f_FirmwareSpecific[8]; }; /// @brief Bootloader main type. -- cgit v1.2.3