\r
PeHdr = NULL;\r
TeHdr = NULL;\r
+ OptionHeader.Header = NULL;\r
//\r
// Assume success\r
//\r
//\r
// Get the DebugEntry offset in the raw data image.\r
//\r
- SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);\r
- Index = Hdr.Te->NumberOfSections;\r
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);\r
+ Index = Hdr.Te->NumberOfSections;\r
for (Index1 = 0; Index1 < Index; Index1 ++) {\r
- if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
- (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +\r
DirectoryEntry->VirtualAddress - \r
SectionHeader [Index1].VirtualAddress + \r
// Get the DebugEntry offset in the raw data image.\r
//\r
for (Index1 = 0; Index1 < Index; Index1 ++) {\r
- if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
- (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (\r
(UINTN) Pe32Data + \r
DirectoryEntry->VirtualAddress - \r
for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {\r
if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {\r
if (DebugEntry->SizeOfData > 0) {\r
- //\r
- // Get the DebugEntry offset in the raw data image.\r
- //\r
- for (Index1 = 0; Index1 < Index; Index1 ++) {\r
- if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && \r
- (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
- CodeViewEntryPointer = (VOID *) (\r
- ((UINTN)Pe32Data) + \r
- (UINTN) DebugEntry->RVA - \r
- SectionHeader[Index1].VirtualAddress + \r
- SectionHeader[Index1].PointerToRawData + \r
- (UINTN)TEImageAdjust);\r
- break;\r
- }\r
- }\r
- if (Index1 >= Index) {\r
- //\r
- // Can't find CodeViewEntryPointer in raw PE/COFF image.\r
- //\r
- continue;\r
- }\r
+ //\r
+ // Get the DebugEntry offset in the raw data image.\r
+ //\r
+ CodeViewEntryPointer = NULL;\r
+ for (Index1 = 0; Index1 < Index; Index1 ++) {\r
+ if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && \r
+ (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+ CodeViewEntryPointer = (VOID *) (\r
+ ((UINTN)Pe32Data) + \r
+ (UINTN) DebugEntry->RVA - \r
+ SectionHeader[Index1].VirtualAddress + \r
+ SectionHeader[Index1].PointerToRawData + \r
+ (UINTN)TEImageAdjust);\r
+ break;\r
+ }\r
+ }\r
+ if (Index1 >= Index) {\r
+ //\r
+ // Can't find CodeViewEntryPointer in raw PE/COFF image.\r
+ //\r
+ continue;\r
+ }\r
switch (* (UINT32 *) CodeViewEntryPointer) {\r
case CODEVIEW_SIGNATURE_NB10:\r
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));\r
//\r
STATIC STATUS mStatus = STATUS_SUCCESS;\r
STATIC CHAR8 mUtilityName[50] = { 0 };\r
-STATIC UINT32 mPrintLogLevel = INFO_LOG_LEVEL;\r
+STATIC UINT64 mPrintLogLevel = INFO_LOG_LEVEL;\r
STATIC CHAR8 *mSourceFileName = NULL;\r
STATIC UINT32 mSourceFileLineNum = 0;\r
STATIC UINT32 mErrorCount = 0;\r
DebugMsg (\r
CHAR8 *FileName,\r
UINT32 LineNumber,\r
- UINT32 MsgLevel,\r
+ UINT64 MsgLevel,\r
CHAR8 *Text,\r
CHAR8 *MsgFmt,\r
...\r
\r
VOID\r
SetPrintLevel (\r
- UINT32 LogLevel\r
+ UINT64 LogLevel\r
)\r
/*++\r
\r
DebugMsg (\r
CHAR8 *FileName,\r
UINT32 LineNumber,\r
- UINT32 MsgLevel,\r
+ UINT64 MsgLevel,\r
CHAR8 *OffendingText,\r
CHAR8 *MsgFmt,\r
...\r
\r
VOID\r
SetPrintLevel (\r
- UINT32 LogLevel\r
+ UINT64 LogLevel\r
);\r
\r
VOID\r
GUID_SEC_TOOL_ENTRY *NewGuidTool;\r
\r
FirstGuidTool = NULL;\r
+ LastGuidTool = NULL;\r
\r
while (TRUE) {\r
NextLine = ReadMemoryFileLine (InputFile);\r
UINT64 : file size of input file\r
--*/\r
{\r
- UINT64 filesize, offset, length;\r
+ UINT32 filesize, offset, length;\r
CHAR8 Buffer[8*1024];\r
\r
fseek (in, 0, SEEK_END);\r
continue; \r
}\r
//\r
- // Don't recognize the paramter, should be regarded as the input file name.\r
+ // Don't recognize the parameter, should be regarded as the input file name.\r
//\r
InputFileNames[InputFileCount] = argv[0];\r
InputFileCount++;\r
// And in the same time update the EfiLdrHeader and EfiLdrImage array\r
//\r
EfiLdrImage[i].Offset = EfiLdrHeader.FileLength;\r
- EfiLdrImage[i].Length = filesize;\r
+ EfiLdrImage[i].Length = (UINT32) filesize;\r
strncpy ((CHAR8*) EfiLdrImage[i].FileName, InputFileNames[i], sizeof (EfiLdrImage[i].FileName) - 1);\r
- EfiLdrHeader.FileLength += filesize;\r
+ EfiLdrHeader.FileLength += (UINT32) filesize;\r
EfiLdrHeader.NumberOfImages++;\r
}\r
\r
// If dumping an image, then do that and quit\r
//\r
if (mOptions.DumpOption == 1) {\r
- for (FList = mOptions.FileList; FList != NULL; FList = FList->Next) {\r
- if ((Ptr0 = strstr ((CONST CHAR8 *)FList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {\r
+ if (mOptions.FileList != NULL) {\r
+ if ((Ptr0 = strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {\r
DumpImage (mOptions.FileList);\r
goto BailOut;\r
} else {\r
UINT32 Index;\r
UINT8 ByteCheckSum;\r
\r
-\r
+ PciDs23 = NULL;\r
+ PciDs30 = NULL;\r
Status = STATUS_SUCCESS;\r
\r
//\r
return 1;\r
}\r
if (DebugLevel > 9) {\r
- Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", Argv[1]);\r
+ Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, current input level is %d", Argv[1]);\r
return 1;\r
}\r
if (DebugLevel>=5 && DebugLevel<=9) {\r
#include <string.h>\r
#include <Common/UefiBaseTypes.h>\r
\r
+#include "ParseInf.h"\r
+#include "EfiUtilityMsgs.h"\r
+\r
//\r
// Utility Name\r
//\r
BYTE DiskPartition[0x200] = {0};\r
BYTE DiskPartitionBackup[0x200] = {0};\r
DWORD BytesReturn;\r
- DWORD DbrOffset;\r
INT DrvNumOffset;\r
HANDLE InputHandle;\r
HANDLE OutputHandle;\r
- BOOL WriteToDisk;\r
ERROR_STATUS Status;\r
DWORD InputDbrOffset;\r
DWORD OutputDbrOffset;\r
#include <stdlib.h>\r
#include <string.h>\r
\r
+#include "ParseInf.h"\r
#include "EfiUtilityMsgs.h"\r
#include "CommonLib.h"\r
#include "Crc32.h"\r
if (FfsAlign < Index) {\r
FfsAlign = Index;\r
}\r
- VerboseMsg ("the alignment of the genreated FFS file is %d", mFfsValidAlign [FfsAlign + 1]); \r
- FfsFileHeader.Attributes = FfsAttrib | (FfsAlign << 3);\r
+ VerboseMsg ("the alignment of the generated FFS file is %d", mFfsValidAlign [FfsAlign + 1]); \r
+ FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3));\r
\r
//\r
// Now FileSize includes the EFI_FFS_FILE_HEADER\r
//\r
FileSize += sizeof (EFI_FFS_FILE_HEADER);\r
- VerboseMsg ("the size of the genreated FFS file is %d bytes", FileSize);\r
+ VerboseMsg ("the size of the generated FFS file is %d bytes", FileSize);\r
FfsFileHeader.Size[0] = (UINT8) (FileSize & 0xFF);\r
FfsFileHeader.Size[1] = (UINT8) ((FileSize & 0xFF00) >> 8);\r
FfsFileHeader.Size[2] = (UINT8) ((FileSize & 0xFF0000) >> 16);\r
Index = 0;\r
mFvTotalSize = 0;\r
mFvTakenSize = 0;\r
+ Status = EFI_SUCCESS;\r
\r
SetUtilityName (UTILITY_NAME);\r
\r
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
return STATUS_ERROR; \r
}\r
- mFvDataInfo.SizeofFvFiles[Index] = TempNumber;\r
+ mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;\r
DebugMsg (NULL, 0, 9, "FV component file size", "the %dth size is %s", Index + 1, argv[1]);\r
argc -= 2;\r
argv += 2;\r
fprintf (FpFile, "\n");\r
if (mFvDataInfo.BootBaseAddress != 0) {\r
fprintf (FpFile, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING);\r
- fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.BootBaseAddress);\r
+ fprintf (FpFile, " = 0x%llx\n", mFvDataInfo.BootBaseAddress);\r
DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.BootBaseAddress);\r
}\r
if (mFvDataInfo.RuntimeBaseAddress != 0) {\r
fprintf (FpFile, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING);\r
- fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.RuntimeBaseAddress);\r
+ fprintf (FpFile, " = 0x%llx\n", mFvDataInfo.RuntimeBaseAddress);\r
DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.RuntimeBaseAddress);\r
}\r
fclose (FpFile);\r
{\r
CHAR8 Value[_MAX_PATH];\r
UINT64 Value64;\r
- UINTN Index, Number, Index1;\r
+ UINTN Index;\r
+ UINTN Number;\r
EFI_STATUS Status;\r
EFI_GUID GuidValue;\r
\r
//\r
if (ImageBaseAddress == 0) {\r
fprintf (FvMapFile, "%s (dummy) (", KeyWord);\r
- fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress);\r
+ fprintf (FvMapFile, "BaseAddress=%08llx, ", ImageBaseAddress);\r
} else {\r
fprintf (FvMapFile, "%s (", KeyWord);\r
- fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress + Offset);\r
+ fprintf (FvMapFile, "BaseAddress=%08llx, ", ImageBaseAddress + Offset);\r
}\r
- fprintf (FvMapFile, "EntryPoint=%08lx, ", ImageBaseAddress + AddressOfEntryPoint);\r
+ fprintf (FvMapFile, "EntryPoint=%08llx, ", ImageBaseAddress + AddressOfEntryPoint);\r
fprintf (FvMapFile, "GUID=%s", FileGuidName);\r
fprintf (FvMapFile, ")\n"); \r
\r
for (; Index > 0; Index --, SectionHeader ++) {\r
if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {\r
- fprintf (FvMapFile, ".textbaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress);\r
+ fprintf (FvMapFile, ".textbaseaddress=%08llx ",ImageBaseAddress + SectionHeader->VirtualAddress);\r
} else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {\r
- fprintf (FvMapFile, ".databaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress);\r
+ fprintf (FvMapFile, ".databaseaddress=%08llx ",ImageBaseAddress + SectionHeader->VirtualAddress);\r
}\r
}\r
fprintf (FvMapFile, "\n\n"); \r
// Printf Function Information\r
//\r
if (FunctionType == 1) {\r
- sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);\r
+ sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);\r
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {\r
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);\r
- fprintf (FvMapFile, "(%08lx) F ", FunctionAddress - Offset);\r
+ fprintf (FvMapFile, " %016llx ", ImageBaseAddress + FunctionAddress);\r
+ fprintf (FvMapFile, "(%08llx) F ", FunctionAddress - Offset);\r
fprintf (FvMapFile, "%s\n", FunctionName);\r
} else {\r
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);\r
- fprintf (FvMapFile, "(%08lx) ", FunctionAddress - Offset);\r
+ fprintf (FvMapFile, " %016llx ", ImageBaseAddress + FunctionAddress);\r
+ fprintf (FvMapFile, "(%08llx) ", FunctionAddress - Offset);\r
fprintf (FvMapFile, "%s\n", FunctionName);\r
}\r
} else if (FunctionType == 2) {\r
- sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);\r
+ sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);\r
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {\r
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);\r
- fprintf (FvMapFile, "(%08lx) FS ", FunctionAddress - Offset);\r
+ fprintf (FvMapFile, " %016llx ", ImageBaseAddress + FunctionAddress);\r
+ fprintf (FvMapFile, "(%08llx) FS ", FunctionAddress - Offset);\r
fprintf (FvMapFile, "%s\n", FunctionName);\r
} else {\r
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);\r
- fprintf (FvMapFile, "(%08lx) ", FunctionAddress - Offset);\r
+ fprintf (FvMapFile, " %016llx ", ImageBaseAddress + FunctionAddress);\r
+ fprintf (FvMapFile, "(%08llx) ", FunctionAddress - Offset);\r
fprintf (FvMapFile, "%s\n", FunctionName);\r
}\r
}\r
// \r
Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - IA32_SEC_CORE_ENTRY_OFFSET);\r
\r
- Ia32SecEntryOffset = SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2);\r
+ Ia32SecEntryOffset = (INT32) (SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2));\r
if (Ia32SecEntryOffset <= -65536) {\r
Error (NULL, 0, 3000, "Invalid", "The SEC EXE file size is too large, it must be less than 64K.");\r
return STATUS_ERROR;\r
//\r
// IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV. \r
//\r
- IpiVector = FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer);\r
+ IpiVector = (UINT32) (FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer));\r
DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", IpiVector);\r
- if (IpiVector & 0xFFF != 0) {\r
+ if ((IpiVector & 0xFFF) != 0) {\r
Error (NULL, 0, 3000, "Invalid", "Startup AP Vector address are not 4K aligned, because the FV size is not 4K aligned");\r
return EFI_ABORTED;\r
}\r
FIQ +24\r
\r
We support two schemes on ARM.\r
- 1) Begining of the FV is the reset vector\r
+ 1) Beginning of the FV is the reset vector\r
2) Reset vector is data bytes FDF file and that code branches to reset vector \r
in the beginning of the FV (fixed size offset).\r
\r
//\r
// Check XipAddress, BootAddress and RuntimeAddress\r
//\r
- Flags = 0;\r
-\r
+ Flags = 0;\r
+ XipBase = 0;\r
if (FvInfo->BaseAddress != 0) {\r
Flags |= REBASE_XIP_FILE;\r
XipBase = FvInfo->BaseAddress + XipOffset;\r
\r
#ifndef __GNUC__\r
#include <windows.h>\r
+#include <io.h>\r
#endif\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>\r
\r
#include "CommonLib.h"\r
+#include "PeCoffLib.h"\r
+#include "ParseInf.h"\r
#include "EfiUtilityMsgs.h"\r
\r
#include "elf_common.h"\r
// PE section alignment.\r
//\r
const UINT32 CoffAlignment = 0x20;\r
-const UINT32 CoffNbrSections = 4;\r
+const UINT16 CoffNbrSections = 4;\r
\r
//\r
// Current offset in coff file.\r
}\r
\r
NtHdr->Pe32.FileHeader.NumberOfSections = CoffNbrSections;\r
- NtHdr->Pe32.FileHeader.TimeDateStamp = time(NULL);\r
+ NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL);\r
NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0;\r
NtHdr->Pe32.FileHeader.NumberOfSymbols = 0;\r
NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader);\r
//\r
// Fill the entry.\r
//\r
- CoffAddFixupEntry((Type << 12) | (Offset & 0xfff));\r
+ CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));\r
}\r
\r
\r
UINT32 SectionLength;\r
UINT32 SectionNumber;\r
CHAR8 *PdbPointer;\r
- INT32 Index = 0;\r
+ INT32 Index;\r
+ UINT32 Index2;\r
\r
- for (Index = 0; Index < SectionTotalNumber; Index ++) {\r
- if (stricmp ((char *)SectionHeader[Index].Name, ".zdata") == 0) {\r
+ for (Index2 = 0; Index2 < SectionTotalNumber; Index2++) {\r
+ if (stricmp ((char *)SectionHeader[Index2].Name, ".zdata") == 0) {\r
//\r
// try to zero the customized .zdata section, which is mapped to .xdata\r
//\r
- memset (FileBuffer + SectionHeader[Index].PointerToRawData, 0, SectionHeader[Index].SizeOfRawData);\r
- DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[Index].PointerToRawData, SectionHeader[Index].SizeOfRawData);\r
+ memset (FileBuffer + SectionHeader[Index2].PointerToRawData, 0, SectionHeader[Index2].SizeOfRawData);\r
+ DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[Index2].PointerToRawData, SectionHeader[Index2].SizeOfRawData);\r
return;\r
}\r
}\r
DosHdr->e_lfanew = BackupDosHdr.e_lfanew;\r
\r
for (Index = sizeof (EFI_IMAGE_DOS_HEADER); Index < (UINT32 ) DosHdr->e_lfanew; Index++) {\r
- FileBuffer[Index] = DosHdr->e_cp;\r
+ FileBuffer[Index] = (UINT8) DosHdr->e_cp;\r
}\r
}\r
\r
struct tm stime;\r
struct tm *ptime;\r
time_t newtime;\r
- UINT32 Index;\r
- UINT32 DebugDirectoryEntryRva;\r
- UINT32 DebugDirectoryEntryFileOffset;\r
- UINT32 ExportDirectoryEntryRva;\r
- UINT32 ExportDirectoryEntryFileOffset;\r
- UINT32 ResourceDirectoryEntryRva;\r
- UINT32 ResourceDirectoryEntryFileOffset;\r
+ UINT32 Index;\r
+ UINT32 DebugDirectoryEntryRva;\r
+ UINT32 DebugDirectoryEntryFileOffset;\r
+ UINT32 ExportDirectoryEntryRva;\r
+ UINT32 ExportDirectoryEntryFileOffset;\r
+ UINT32 ResourceDirectoryEntryRva;\r
+ UINT32 ResourceDirectoryEntryFileOffset;\r
EFI_IMAGE_DOS_HEADER *DosHdr;\r
EFI_IMAGE_FILE_HEADER *FileHdr;\r
EFI_IMAGE_OPTIONAL_HEADER32 *Optional32Hdr;\r
//\r
// Init variable.\r
//\r
- DebugDirectoryEntryRva = 0;\r
- ExportDirectoryEntryRva = 0;\r
- ResourceDirectoryEntryRva = 0;\r
+ DebugDirectoryEntryRva = 0;\r
+ DebugDirectoryEntryFileOffset = 0;\r
+ ExportDirectoryEntryRva = 0;\r
+ ExportDirectoryEntryFileOffset = 0;\r
+ ResourceDirectoryEntryRva = 0;\r
+ ResourceDirectoryEntryFileOffset = 0;\r
//\r
// Get time and date that will be set.\r
//\r
#include <string.h>\r
#include "VirtualMemory.h"\r
#include "EfiUtilityMsgs.h"\r
+#include "ParseInf.h"\r
\r
#define EFI_PAGE_BASE_OFFSET_IN_LDR 0x70000\r
#define EFI_PAGE_BASE_ADDRESS (EFI_PAGE_BASE_OFFSET_IN_LDR + 0x20000)\r
VendorGuidSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));\r
VendorGuidSect->Attributes = DataAttribute;\r
- VendorGuidSect->DataOffset = sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize;\r
+ VendorGuidSect->DataOffset = (UINT16) (sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize);\r
DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", VendorGuidSect->DataOffset);\r
}\r
VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
\r
Routine Description:\r
\r
- This function intializes the relevant global variable which is being\r
+ This function initializes the relevant global variable which is being\r
used to store the information retrieved from INF file. This also initializes\r
the VTF symbol file.\r
\r
\r
Routine Description:\r
\r
- This function intializes the relevant global variable which is being\r
+ This function initializes the relevant global variable which is being\r
used to store the information retrieved from INF file.\r
\r
Arguments:\r
\r
Fv1BaseAddress = StartAddress1;\r
Fv1EndAddress = Fv1BaseAddress + Size1;\r
- if (Fv1EndAddress != 0x100000000 || Size1 < 0x100000) {\r
+ if (Fv1EndAddress != 0x100000000ULL || Size1 < 0x100000) {\r
Error (NULL, 0, 2000, "Invalid parameter", "Error BaseAddress and Size parameters!");\r
if (Size1 < 0x100000) {\r
Error (NULL, 0, 2000, "Invalid parameter", "The FwVolumeSize must be larger than 1M!");\r
TokenAddress += BaseAddress &~IPF_CACHE_BIT;\r
\r
#ifdef __GNUC__\r
- fprintf (DestFile, "%s | %016lX | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);\r
+ fprintf (DestFile, "%s | %016llX | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);\r
#else\r
fprintf (DestFile, "%s | %016I64X | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);\r
#endif\r
break;\r
\r
case EFI_ABORTED:\r
- Error (NULL, 0, 3000, "Invaild", "Error detected while creating the file image.");\r
+ Error (NULL, 0, 3000, "Invalid", "Error detected while creating the file image.");\r
break;\r
\r
case EFI_OUT_OF_RESOURCES:\r
break;\r
\r
case EFI_VOLUME_CORRUPTED:\r
- Error (NULL, 0, 3000, "Invaild", "No base address was specified.");\r
+ Error (NULL, 0, 3000, "Invalid", "No base address was specified.");\r
break;\r
\r
default:\r
- Error (NULL, 0, 3000, "Invaild", "GenVtfImage function returned unknown status %x.",Status );\r
+ Error (NULL, 0, 3000, "Invalid", "GenVtfImage function returned unknown status %x.",Status );\r
break;\r
}\r
}\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <string.h>\r
+#ifndef __GNUC__\r
+#include <io.h>\r
+#endif\r
#include "assert.h"\r
#include <Common/PiFirmwareFile.h>\r
#include "ParseInf.h"\r
#include <string.h>\r
#include <Common/UefiBaseTypes.h>\r
\r
+#include "ParseInf.h"\r
+#include "EfiUtilityMsgs.h"\r
+\r
//\r
// Utility Name\r
//\r
#include <stdarg.h>\r
\r
//\r
-// Modifiers to absract standard types to aid in debug of problems\r
+// Modifiers to abstract standard types to aid in debug of problems\r
//\r
#define CONST const\r
#define STATIC static\r
//\r
#ifndef IN\r
//\r
-// Some other envirnments use this construct, so #ifndef to prevent\r
-// mulitple definition.\r
+// Some other environments use this construct, so #ifndef to prevent\r
+// multiple definition.\r
//\r
#define IN\r
#define OUT\r
//\r
// Support for variable length argument lists using the ANSI standard.\r
// \r
-// Since we are using the ANSI standard we used the standard nameing and\r
-// did not folow the coding convention\r
+// Since we are using the ANSI standard we used the standard naming and\r
+// did not follow the coding convention\r
//\r
// VA_LIST - typedef for argument list.\r
// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.\r
// VA_END (VA_LIST Marker) - Clear Marker\r
-// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from\r
+// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from\r
// the ... list. You must know the size and pass it in this macro.\r
//\r
// example:\r
#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))\r
\r
///\r
-/// ALIGN_POINTER - aligns a pointer to the lowest boundry\r
+/// ALIGN_POINTER - aligns a pointer to the lowest boundary\r
///\r
#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))\r
\r
///\r
-/// ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor\r
+/// ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor\r
///\r
#define ALIGN_VARIABLE(Value, Adjustment) \\r
Adjustment = 0U; \\r
#pragma warning ( disable : 4057 )\r
\r
//\r
-// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
+// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r
//\r
#pragma warning ( disable : 4127 )\r
\r
//\r
// Modifier to ensure that all protocol member functions and EFI intrinsics\r
// use the correct C calling convention. All protocol member functions and\r
-// EFI intrinsics are required to modify thier member functions with EFIAPI.\r
+// EFI intrinsics are required to modify their member functions with EFIAPI.\r
//\r
#if _MSC_EXTENSIONS\r
//\r
CFileSeqInStream inStream;\r
CFileOutStream outStream;\r
int res;\r
- int encodeMode;\r
+ int encodeMode = 0;\r
Bool modeWasSet = False;\r
const char *inputFile = NULL;\r
const char *outputFile = "file.tmp";\r
INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
CPPFLAGS = $(INCLUDE)
-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -c -g
+CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g
.PHONY: all
.PHONY: install
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
-CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
+CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
#include <stdlib.h>\r
#ifdef __GNUC__\r
#include <unistd.h>\r
+#else\r
+#include <direct.h>\r
#endif\r
#include <ctype.h>\r
#include "ParseInf.h"\r
CHAR8 *OutputDir = NULL;\r
CHAR8 *OutFileName1 = NULL;\r
CHAR8 *OutFileName2 = NULL;\r
- UINT64 SplitValue = -1;\r
+ UINT64 SplitValue = (UINT64) -1;\r
FILE *Out1;\r
FILE *Out2;\r
CHAR8 *OutName1 = NULL;\r
\r
STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;\r
\r
-static UINTN DebugLevel;\r
+static UINT64 DebugLevel;\r
static BOOLEAN DebugMode;\r
//\r
// functions\r
\r
if (mCompSize + 1 + 8 > *DstSize) {\r
*DstSize = mCompSize + 1 + 8; \r
- return EFI_BUFFER_TOO_SMALL;\r
- } else {\r
+ return EFI_BUFFER_TOO_SMALL;\r
+ } else {\r
*DstSize = mCompSize + 1 + 8; \r
- return EFI_SUCCESS;\r
- }\r
- return EFI_SUCCESS;\r
+ return EFI_SUCCESS;\r
+ }\r
}\r
\r
STATIC\r
{
CHAR8* PeerFilename;
CHAR8* Places[] = {
- FirmwareVolumeFilename,
- //mUtilityFilename,
+ NULL,
+ //NULL,
};
UINTN Index;
+ Places[0] = FirmwareVolumeFilename;
+ //Places[1] = mUtilityFilename;
+
mParsedGuidedSectionTools = NULL;
for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) {