diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-15 19:53:15 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-15 19:53:15 +0000 |
commit | e862cd50c6a12183204ba0fa93403d88fd2e0376 (patch) | |
tree | ff484f16ff41d6778ab04f1edff7244365217611 /ArmPkg/Library/BdsLib | |
parent | 2b59fcd5b3d446ec2f509a68fda24dce62d4c8d3 (diff) | |
download | edk2-platforms-e862cd50c6a12183204ba0fa93403d88fd2e0376.tar.xz |
ArmPkg: Fix warnings raised by ARMGCC
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11829 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Library/BdsLib')
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsAppLoader.c | 79 | ||||
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsFilePath.c | 7 |
2 files changed, 7 insertions, 79 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsAppLoader.c b/ArmPkg/Library/BdsLib/BdsAppLoader.c index d14e3c5dcc..8b778b27f7 100644 --- a/ArmPkg/Library/BdsLib/BdsAppLoader.c +++ b/ArmPkg/Library/BdsLib/BdsAppLoader.c @@ -14,82 +14,7 @@ #include "BdsInternal.h" -//#include <Library/PeCoffLib.h> -#include <Library/DxeServicesLib.h> - -//TODO: RemoveMe -#include <Protocol/DevicePathToText.h> - -/** - Retrieves the magic value from the PE/COFF header. - - @param Hdr The buffer in which to return the PE32, PE32+, or TE header. - - @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32 - @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+ - -**/ -UINT16 -PeCoffLoaderGetPeHeaderMagicValue ( - IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr - ) -{ - // - // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value - // in the PE/COFF Header. If the MachineType is Itanium(IA64) and the - // Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - // then override the returned value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - // - if (Hdr.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC; - } - // - // Return the magic value from the PC/COFF Optional Header - // - return Hdr.Pe32->OptionalHeader.Magic; -} - -STATIC -BOOLEAN -IsLoadableImage ( - VOID* Image - ) -{ - UINT16 Magic; - EFI_IMAGE_DOS_HEADER *DosHeader; - EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Header; - - if (Image == NULL) { - return FALSE; - } - - DosHeader = (EFI_IMAGE_DOS_HEADER*)Image; - if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) { - Header.Pe32 = (EFI_IMAGE_NT_HEADERS32*)((UINT8*)Image + DosHeader->e_lfanew); - } else { - Header.Pe32 = (EFI_IMAGE_NT_HEADERS32*)(Image); - } - - if (Header.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { - // It is a TE Image - return TRUE; - } else if (Header.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { - Magic = PeCoffLoaderGetPeHeaderMagicValue (Header); - if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { - // It is a PE32 Image - return TRUE; - } else if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) { - // It is a PE32+ Image - return TRUE; - } else { - DEBUG ((EFI_D_ERROR,"BdsLoadBinaryFromPath(): Fail unrecognized PE Image\n")); - } - } else { - DEBUG ((EFI_D_ERROR,"BdsLoadBinaryFromPath(): Fail unrecognize image\n")); - } - - return FALSE; -} +//#include <Library/DxeServicesLib.h> STATIC EFI_STATUS @@ -186,7 +111,6 @@ BdsLoadApplication ( EFI_STATUS Status; UINTN NoHandles, HandleIndex; EFI_HANDLE *Handles; - EFI_DEVICE_PATH *FvDevicePath; EFI_DEVICE_PATH *EfiAppDevicePath; // Need to connect every drivers to ensure no dependencies are missing for the application @@ -205,6 +129,7 @@ BdsLoadApplication ( // Search in all Firmware Volume for the EFI Application for (HandleIndex = 0; HandleIndex < NoHandles; HandleIndex++) { + EfiAppDevicePath = NULL; Status = BdsLoadFileFromFirmwareVolume (Handles[HandleIndex], EfiApp, EFI_FV_FILETYPE_APPLICATION, &EfiAppDevicePath); if (!EFI_ERROR (Status)) { // Start the application diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c index f7a06e5a89..be1a824d50 100644 --- a/ArmPkg/Library/BdsLib/BdsFilePath.c +++ b/ArmPkg/Library/BdsLib/BdsFilePath.c @@ -264,8 +264,11 @@ TryRemovableDevice ( EFI_DEVICE_PATH* RemovableDevicePath; BOOLEAN RemovableFound; - RemovableFound = FALSE; - TmpDevicePath = DevicePath; + RemovableDevice = NULL; + RemovableDevicePath = NULL; + RemovableFound = FALSE; + TmpDevicePath = DevicePath; + while (!IsDevicePathEnd (TmpDevicePath) && !RemovableFound) { for (Index = 0; Index < sizeof(RemovableDeviceSupport) / sizeof(BDS_REMOVABLE_DEVICE_SUPPORT); Index++) { RemovableDevice = &RemovableDeviceSupport[Index]; |