mirror of
https://github.com/acidanthera/audk.git
synced 2025-09-22 17:27:44 +02:00
ImageTool: Replace raise() with DEBUG_RAISE()
This commit is contained in:
parent
4166d3ffd3
commit
dd8a4d1f82
@ -42,7 +42,7 @@ ImageToolBufferExpand (
|
|||||||
&NewAllocatedSize
|
&NewAllocatedSize
|
||||||
);
|
);
|
||||||
if (Overflow) {
|
if (Overflow) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return MAX_UINT32;
|
return MAX_UINT32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,13 +52,13 @@ ImageToolBufferExpand (
|
|||||||
&NewAllocatedSize
|
&NewAllocatedSize
|
||||||
);
|
);
|
||||||
if (Overflow) {
|
if (Overflow) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return MAX_UINT32;
|
return MAX_UINT32;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewMemory = realloc (Buffer->Memory, NewAllocatedSize);
|
NewMemory = realloc (Buffer->Memory, NewAllocatedSize);
|
||||||
if (NewMemory == NULL) {
|
if (NewMemory == NULL) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return MAX_UINT32;
|
return MAX_UINT32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,18 +20,18 @@ CheckToolImageSegment (
|
|||||||
assert (PreviousEndAddress != NULL);
|
assert (PreviousEndAddress != NULL);
|
||||||
|
|
||||||
if (!IS_ALIGNED (Segment->ImageSize, SegmentInfo->SegmentAlignment)) {
|
if (!IS_ALIGNED (Segment->ImageSize, SegmentInfo->SegmentAlignment)) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Segment->Write && Segment->Execute) {
|
if (Segment->Write && Segment->Execute) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Expand prior segment
|
// FIXME: Expand prior segment
|
||||||
if (Segment->ImageAddress != *PreviousEndAddress) {
|
if (Segment->ImageAddress != *PreviousEndAddress) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ CheckToolImageSegment (
|
|||||||
PreviousEndAddress
|
PreviousEndAddress
|
||||||
);
|
);
|
||||||
if (Overflow) {
|
if (Overflow) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,17 +62,17 @@ CheckToolImageSegmentInfo (
|
|||||||
assert (ImageSize != NULL);
|
assert (ImageSize != NULL);
|
||||||
|
|
||||||
if (!IS_POW2 (SegmentInfo->SegmentAlignment)) {
|
if (!IS_POW2 (SegmentInfo->SegmentAlignment)) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SegmentInfo->NumSegments == 0) {
|
if (SegmentInfo->NumSegments == 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_ALIGNED (SegmentInfo->Segments[0].ImageAddress, SegmentInfo->SegmentAlignment)) {
|
if (!IS_ALIGNED (SegmentInfo->Segments[0].ImageAddress, SegmentInfo->SegmentAlignment)) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ CheckToolImageSegmentInfo (
|
|||||||
ImageSize
|
ImageSize
|
||||||
);
|
);
|
||||||
if (!Result) {
|
if (!Result) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,24 +169,24 @@ CheckToolImageReloc (
|
|||||||
&Image->SegmentInfo
|
&Image->SegmentInfo
|
||||||
);
|
);
|
||||||
if (Segment == NULL) {
|
if (Segment == NULL) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RelocSize = ToolImageGetRelocSize (Reloc->Type);
|
RelocSize = ToolImageGetRelocSize (Reloc->Type);
|
||||||
if (RelocSize == 0) {
|
if (RelocSize == 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RelocSize > RemainingSize) {
|
if (RelocSize > RemainingSize) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Reloc->Type == EFI_IMAGE_REL_BASED_ARM_MOV32T) {
|
if (Reloc->Type == EFI_IMAGE_REL_BASED_ARM_MOV32T) {
|
||||||
if (!IS_ALIGNED (Reloc->Target, ALIGNOF (UINT16))) {
|
if (!IS_ALIGNED (Reloc->Target, ALIGNOF (UINT16))) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ CheckToolImageReloc (
|
|||||||
MovLow = *(const uint16_t *)&Segment->Data[RelocOffset + 2];
|
MovLow = *(const uint16_t *)&Segment->Data[RelocOffset + 2];
|
||||||
if (((MovHigh & 0xFBF0U) != 0xF200U && (MovHigh & 0xFBF0U) != 0xF2C0U) ||
|
if (((MovHigh & 0xFBF0U) != 0xF200U && (MovHigh & 0xFBF0U) != 0xF2C0U) ||
|
||||||
(MovLow & 0x8000U) != 0) {
|
(MovLow & 0x8000U) != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ CheckToolImageReloc (
|
|||||||
Image->HeaderInfo.Subsystem == EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER) &&
|
Image->HeaderInfo.Subsystem == EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER) &&
|
||||||
Segment->Write) {
|
Segment->Write) {
|
||||||
printf("!!! writable reloc at %x !!!\n", Reloc->Target);
|
printf("!!! writable reloc at %x !!!\n", Reloc->Target);
|
||||||
//raise ();
|
//DEBUG_RAISE ();
|
||||||
//return false;
|
//return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,12 +232,12 @@ CheckToolImageRelocInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (RelocInfo->RelocsStripped) {
|
if (RelocInfo->RelocsStripped) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RelocInfo->NumRelocs > (MAX_UINT32 / sizeof (UINT16))) {
|
if (RelocInfo->NumRelocs > (MAX_UINT32 / sizeof (UINT16))) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ CheckToolImageRelocInfo (
|
|||||||
|
|
||||||
Result = CheckToolImageReloc (Image, ImageSize, &RelocInfo->Relocs[Index]);
|
Result = CheckToolImageReloc (Image, ImageSize, &RelocInfo->Relocs[Index]);
|
||||||
if (!Result) {
|
if (!Result) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ CheckToolImageDebugInfo (
|
|||||||
if (DebugInfo->SymbolsPath != NULL) {
|
if (DebugInfo->SymbolsPath != NULL) {
|
||||||
// FIXME: UE-only?
|
// FIXME: UE-only?
|
||||||
if (DebugInfo->SymbolsPathLen > MAX_UINT8) {
|
if (DebugInfo->SymbolsPathLen > MAX_UINT8) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,19 +292,19 @@ CheckToolImage (
|
|||||||
|
|
||||||
Result = CheckToolImageSegmentInfo (&Image->SegmentInfo, &ImageSize);
|
Result = CheckToolImageSegmentInfo (&Image->SegmentInfo, &ImageSize);
|
||||||
if (!Result) {
|
if (!Result) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result = CheckToolImageRelocInfo (Image, ImageSize);
|
Result = CheckToolImageRelocInfo (Image, ImageSize);
|
||||||
if (!Result) {
|
if (!Result) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result = CheckToolImageDebugInfo (&Image->DebugInfo);
|
Result = CheckToolImageDebugInfo (&Image->DebugInfo);
|
||||||
if (!Result) {
|
if (!Result) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ ToolImageRelocate (
|
|||||||
&Image->SegmentInfo
|
&Image->SegmentInfo
|
||||||
);
|
);
|
||||||
if (Segment == NULL) {
|
if (Segment == NULL) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ ToolImageRelocate (
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -497,7 +497,7 @@ ToolImageCompare (
|
|||||||
sizeof (Image1->HeaderInfo)
|
sizeof (Image1->HeaderInfo)
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ ToolImageCompare (
|
|||||||
OFFSET_OF (image_tool_segment_info_t, Segments)
|
OFFSET_OF (image_tool_segment_info_t, Segments)
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ ToolImageCompare (
|
|||||||
OFFSET_OF (image_tool_segment_t, Name)
|
OFFSET_OF (image_tool_segment_t, Name)
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ ToolImageCompare (
|
|||||||
++NameIndex
|
++NameIndex
|
||||||
) {
|
) {
|
||||||
if (Name1[NameIndex] != Name2[NameIndex]) {
|
if (Name1[NameIndex] != Name2[NameIndex]) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,7 +568,7 @@ ToolImageCompare (
|
|||||||
OFFSET_OF (image_tool_reloc_info_t, Relocs)
|
OFFSET_OF (image_tool_reloc_info_t, Relocs)
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ ToolImageCompare (
|
|||||||
Image1->RelocInfo.NumRelocs * sizeof (*Image1->RelocInfo.Relocs)
|
Image1->RelocInfo.NumRelocs * sizeof (*Image1->RelocInfo.Relocs)
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,7 +592,7 @@ ToolImageCompare (
|
|||||||
OFFSET_OF (image_tool_hii_info_t, Data)
|
OFFSET_OF (image_tool_hii_info_t, Data)
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,12 +616,12 @@ ToolImageCompare (
|
|||||||
OFFSET_OF (image_tool_debug_info_t, SymbolsPath)
|
OFFSET_OF (image_tool_debug_info_t, SymbolsPath)
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Image1->DebugInfo.SymbolsPath != NULL) != (Image2->DebugInfo.SymbolsPath != NULL)) {
|
if ((Image1->DebugInfo.SymbolsPath != NULL) != (Image2->DebugInfo.SymbolsPath != NULL)) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ ToolImageCompare (
|
|||||||
Image2->DebugInfo.SymbolsPath
|
Image2->DebugInfo.SymbolsPath
|
||||||
);
|
);
|
||||||
if (CmpResult != 0) {
|
if (CmpResult != 0) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,6 +418,7 @@ GenExecutable (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (OutputFile == NULL) {
|
if (OutputFile == NULL) {
|
||||||
|
DEBUG_RAISE ();
|
||||||
return RETURN_ABORTED;
|
return RETURN_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +445,7 @@ int main (int argc, const char *argv[])
|
|||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf (stderr, "ImageTool: No command is specified\n");
|
fprintf (stderr, "ImageTool: No command is specified\n");
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -456,7 +457,7 @@ int main (int argc, const char *argv[])
|
|||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
fprintf (stderr, "ImageTool: Command arguments are missing\n");
|
fprintf (stderr, "ImageTool: Command arguments are missing\n");
|
||||||
fprintf (stderr, " Usage: ImageTool GenImage [-c Format] [-t ModuleType] [-b BaseAddress] [-x] [-s] [-f] -o OutputFile InputFile\n");
|
fprintf (stderr, " Usage: ImageTool GenImage [-c Format] [-t ModuleType] [-b BaseAddress] [-x] [-s] [-f] -o OutputFile InputFile\n");
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,14 +539,14 @@ int main (int argc, const char *argv[])
|
|||||||
FixedAddress
|
FixedAddress
|
||||||
);
|
);
|
||||||
if (RETURN_ERROR (Status)) {
|
if (RETURN_ERROR (Status)) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strcmp (argv[1], "HiiSrc") == 0) {
|
} else if (strcmp (argv[1], "HiiSrc") == 0) {
|
||||||
if (argc < 5 || strcmp (argv[3], "-o") != 0) {
|
if (argc < 5 || strcmp (argv[3], "-o") != 0) {
|
||||||
fprintf (stderr, "ImageTool: Command arguments are missing\n");
|
fprintf (stderr, "ImageTool: Command arguments are missing\n");
|
||||||
fprintf (stderr, " Usage: ImageTool HiiBin GUID -o OutputFile InputFile1 InputFile2 ...\n");
|
fprintf (stderr, " Usage: ImageTool HiiBin GUID -o OutputFile InputFile1 InputFile2 ...\n");
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,20 +554,20 @@ int main (int argc, const char *argv[])
|
|||||||
|
|
||||||
Status = HiiSrc (argv[4], argv[2], &argv[5], NumOfFiles);
|
Status = HiiSrc (argv[4], argv[2], &argv[5], NumOfFiles);
|
||||||
if (RETURN_ERROR (Status)) {
|
if (RETURN_ERROR (Status)) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strcmp (argv[1], "GetAcpi") == 0) {
|
} else if (strcmp (argv[1], "GetAcpi") == 0) {
|
||||||
if (argc != 5 || strcmp (argv[2], "-o") != 0) {
|
if (argc != 5 || strcmp (argv[2], "-o") != 0) {
|
||||||
fprintf (stderr, "ImageTool: Command arguments are missing\n");
|
fprintf (stderr, "ImageTool: Command arguments are missing\n");
|
||||||
fprintf (stderr, " Usage: ImageTool GetAcpi -o OutputFile InputFile\n");
|
fprintf (stderr, " Usage: ImageTool GetAcpi -o OutputFile InputFile\n");
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = GetAcpi (argv[4], argv[3]);
|
Status = GetAcpi (argv[4], argv[3]);
|
||||||
if (RETURN_ERROR (Status)) {
|
if (RETURN_ERROR (Status)) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,12 @@
|
|||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/BaseOverflowLib.h>
|
#include <Library/BaseOverflowLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <UserFile.h>
|
#include <UserFile.h>
|
||||||
|
|
||||||
#define MAX_PE_ALIGNMENT 0x10000
|
#define MAX_PE_ALIGNMENT 0x10000
|
||||||
|
|
||||||
#define raise() assert(false)
|
|
||||||
|
|
||||||
#define PAGE(x) ((x) & ~4095U)
|
#define PAGE(x) ((x) & ~4095U)
|
||||||
#define PAGE_OFF(x) ((x) & 4095U)
|
#define PAGE_OFF(x) ((x) & 4095U)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ ValidateOutputFile (
|
|||||||
|
|
||||||
Result = CheckToolImage (&OutputImageInfo);
|
Result = CheckToolImage (&OutputImageInfo);
|
||||||
if (!Result) {
|
if (!Result) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
ToolImageDestruct (&OutputImageInfo);
|
ToolImageDestruct (&OutputImageInfo);
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ ToolImageEmit (
|
|||||||
|
|
||||||
Success = CheckToolImage (&ImageInfo);
|
Success = CheckToolImage (&ImageInfo);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
ToolImageDestruct (&ImageInfo);
|
ToolImageDestruct (&ImageInfo);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ ToolImageEmit (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (OutputFile == NULL) {
|
if (OutputFile == NULL) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ ToolImageEmitPeHiiTable (
|
|||||||
mHiiResourceSectionHeaderSize
|
mHiiResourceSectionHeaderSize
|
||||||
);
|
);
|
||||||
if (HiiTableOffset == MAX_UINT32) {
|
if (HiiTableOffset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ ToolImageEmitPeHiiTable (
|
|||||||
Image->HiiInfo.DataSize
|
Image->HiiInfo.DataSize
|
||||||
);
|
);
|
||||||
if (Offset == MAX_UINT32) {
|
if (Offset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ ToolImageEmitPeHiiTable (
|
|||||||
HiiTableOffset
|
HiiTableOffset
|
||||||
);
|
);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ ToolImageEmitPeRelocTable (
|
|||||||
|
|
||||||
RelocBlockOffset = ImageToolBufferAppendReserve (Buffer, sizeof (RelocBlock));
|
RelocBlockOffset = ImageToolBufferAppendReserve (Buffer, sizeof (RelocBlock));
|
||||||
if (RelocBlockOffset == MAX_UINT32) {
|
if (RelocBlockOffset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ ToolImageEmitPeRelocTable (
|
|||||||
ALIGNOF (EFI_IMAGE_BASE_RELOCATION_BLOCK)
|
ALIGNOF (EFI_IMAGE_BASE_RELOCATION_BLOCK)
|
||||||
);
|
);
|
||||||
if (Offset == MAX_UINT32) {
|
if (Offset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ ToolImageEmitPeRelocTable (
|
|||||||
sizeof (RelocBlock)
|
sizeof (RelocBlock)
|
||||||
);
|
);
|
||||||
if (NewRelocBlockOffset == MAX_UINT32) {
|
if (NewRelocBlockOffset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ ToolImageEmitPeRelocTable (
|
|||||||
|
|
||||||
Offset = ImageToolBufferAppend (Buffer, &Relocation, sizeof (Relocation));
|
Offset = ImageToolBufferAppend (Buffer, &Relocation, sizeof (Relocation));
|
||||||
if (Offset == MAX_UINT32) {
|
if (Offset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ ToolImageEmitPeRelocTable (
|
|||||||
ALIGNOF (EFI_IMAGE_BASE_RELOCATION_BLOCK)
|
ALIGNOF (EFI_IMAGE_BASE_RELOCATION_BLOCK)
|
||||||
);
|
);
|
||||||
if (Offset == MAX_UINT32) {
|
if (Offset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ ToolImageEmitPeRelocTable (
|
|||||||
RelocTableOffset
|
RelocTableOffset
|
||||||
);
|
);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SectionHeader->Characteristics |= EFI_IMAGE_SCN_MEM_DISCARDABLE;
|
SectionHeader->Characteristics |= EFI_IMAGE_SCN_MEM_DISCARDABLE;
|
||||||
@ -285,7 +285,7 @@ ToolImageEmitPeDebugTable (
|
|||||||
|
|
||||||
DebugDirOffset = ImageToolBufferAppendReserve (Buffer, sizeof (*Data));
|
DebugDirOffset = ImageToolBufferAppendReserve (Buffer, sizeof (*Data));
|
||||||
if (DebugDirOffset == MAX_UINT32) {
|
if (DebugDirOffset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ ToolImageEmitPeDebugTable (
|
|||||||
Image->DebugInfo.SymbolsPathLen + 1
|
Image->DebugInfo.SymbolsPathLen + 1
|
||||||
);
|
);
|
||||||
if (Offset == MAX_UINT32) {
|
if (Offset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ ToolImageEmitPeDebugTable (
|
|||||||
DebugDirOffset
|
DebugDirOffset
|
||||||
);
|
);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SectionHeader->Characteristics |= EFI_IMAGE_SCN_MEM_DISCARDABLE;
|
SectionHeader->Characteristics |= EFI_IMAGE_SCN_MEM_DISCARDABLE;
|
||||||
@ -383,7 +383,7 @@ ToolImageEmitPeSection (
|
|||||||
Segment->UnpaddedSize
|
Segment->UnpaddedSize
|
||||||
);
|
);
|
||||||
if (SectionOffset == MAX_UINT32) {
|
if (SectionOffset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ ToolImageEmitPeSections (
|
|||||||
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
||||||
|
|
||||||
if (PeHdr->SizeOfImage != Image->SegmentInfo.Segments[0].ImageAddress) {
|
if (PeHdr->SizeOfImage != Image->SegmentInfo.Segments[0].ImageAddress) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ ToolImageEmitPeSections (
|
|||||||
Segment
|
Segment
|
||||||
);
|
);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,7 +486,7 @@ ToolImageEmitPeSections (
|
|||||||
if (ToolImagePeHiiTableRequired (Image)) {
|
if (ToolImagePeHiiTableRequired (Image)) {
|
||||||
Success = ToolImageEmitPeHiiTable (Buffer, PeHdr, &SectionHeaders[Index], Image);
|
Success = ToolImageEmitPeHiiTable (Buffer, PeHdr, &SectionHeaders[Index], Image);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ ToolImageEmitPeSections (
|
|||||||
if (ToolImagePeRelocTableRequired (Image)) {
|
if (ToolImagePeRelocTableRequired (Image)) {
|
||||||
Success = ToolImageEmitPeRelocTable (Buffer, PeHdr, &SectionHeaders[Index], Image);
|
Success = ToolImageEmitPeRelocTable (Buffer, PeHdr, &SectionHeaders[Index], Image);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ ToolImageEmitPeSections (
|
|||||||
if (ToolImagePeDebugTableRequired (Image)) {
|
if (ToolImagePeDebugTableRequired (Image)) {
|
||||||
Success = ToolImageEmitPeDebugTable (Buffer, PeHdr, &SectionHeaders[Index], Image);
|
Success = ToolImageEmitPeDebugTable (Buffer, PeHdr, &SectionHeaders[Index], Image);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ ToolImageEmitPeSections (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Index == PeHdr->CommonHeader.FileHeader.NumberOfSections) {
|
if (Index == PeHdr->CommonHeader.FileHeader.NumberOfSections) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -576,7 +576,7 @@ ToolImageEmitPeFile (
|
|||||||
|
|
||||||
Offset = ImageToolBufferAppend (Buffer, &mDosHdr, sizeof (mDosHdr));
|
Offset = ImageToolBufferAppend (Buffer, &mDosHdr, sizeof (mDosHdr));
|
||||||
if (Offset == MAX_UINT32) {
|
if (Offset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,13 +591,13 @@ ToolImageEmitPeFile (
|
|||||||
AlignedSizeOfHeaders - sizeof (mDosHdr)
|
AlignedSizeOfHeaders - sizeof (mDosHdr)
|
||||||
);
|
);
|
||||||
if (PeOffset == MAX_UINT32) {
|
if (PeOffset == MAX_UINT32) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeHdr = malloc (SizeOfPeHeaders);
|
PeHdr = malloc (SizeOfPeHeaders);
|
||||||
if (PeHdr == NULL) {
|
if (PeHdr == NULL) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ ToolImageEmitPeFile (
|
|||||||
Success = ToolImageEmitPeSections (Buffer, PeHdr, SectionHeaders, Image, Xip);
|
Success = ToolImageEmitPeSections (Buffer, PeHdr, SectionHeaders, Image, Xip);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
free (PeHdr);
|
free (PeHdr);
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ ToolImageEmitPe (
|
|||||||
|
|
||||||
Success = ToolImageEmitPeFile (&Buffer, Image, Xip);
|
Success = ToolImageEmitPeFile (&Buffer, Image, Xip);
|
||||||
if (!Success) {
|
if (!Success) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
ImageToolBufferFree (&Buffer);
|
ImageToolBufferFree (&Buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -673,7 +673,7 @@ ToolImageEmitPe (
|
|||||||
ImageToolBufferFree (&Buffer);
|
ImageToolBufferFree (&Buffer);
|
||||||
|
|
||||||
if (FileBuffer == NULL) {
|
if (FileBuffer == NULL) {
|
||||||
raise ();
|
DEBUG_RAISE ();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user