summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/GenVtf
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-09 11:47:35 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-09 11:47:35 +0000
commitb303ea726e1c8ed240dad2bce54821318567eab3 (patch)
tree355db6226949afd1bfcc87d69e09a320ea9b7bb7 /BaseTools/Source/C/GenVtf
parent4c913fe619bd00861270cb0866feb34bcdc1592e (diff)
downloadedk2-platforms-b303ea726e1c8ed240dad2bce54821318567eab3.tar.xz
Sync tool code to BuildTools project r1739.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9397 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C/GenVtf')
-rw-r--r--BaseTools/Source/C/GenVtf/GenVtf.c22
-rw-r--r--BaseTools/Source/C/GenVtf/GenVtf.h4
2 files changed, 19 insertions, 7 deletions
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c
index eafbcbf002..890cfd98fd 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -1267,7 +1267,7 @@ Returns:
//
// Update the SYM file for this component based on it's start address.
//
- Status = UpdateSymFile (CompStartAddress, SymFileName, VtfInfo->CompSymName);
+ Status = UpdateSymFile (CompStartAddress, SymFileName, VtfInfo->CompSymName, FileSize);
if (EFI_ERROR (Status)) {
//
@@ -1406,7 +1406,7 @@ Returns:
//
// Update the SYM file for this component based on it's start address.
//
- Status = UpdateSymFile (PalStartAddress, SymFileName, VtfInfo->CompSymName);
+ Status = UpdateSymFile (PalStartAddress, SymFileName, VtfInfo->CompSymName, FileSize);
if (EFI_ERROR (Status)) {
//
@@ -1688,7 +1688,7 @@ Returns:
FileHeader->IntegrityCheck.Checksum.File = 0;
FileHeader->State = 0;
FileHeader->IntegrityCheck.Checksum.Header = CalculateChecksum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
- FileHeader->IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8 *) FileHeader, TotalVtfSize);
+ FileHeader->IntegrityCheck.Checksum.File = CalculateChecksum8 ((UINT8 *) (FileHeader + 1), TotalVtfSize - sizeof (EFI_FFS_FILE_HEADER));
FileHeader->State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
return EFI_SUCCESS;
@@ -2153,7 +2153,9 @@ EFI_STATUS
UpdateSymFile (
IN UINT64 BaseAddress,
IN CHAR8 *DestFileName,
- IN CHAR8 *SourceFileName
+ IN CHAR8 *SourceFileName,
+ IN UINT64 FileSize
+
)
/*++
@@ -2167,6 +2169,7 @@ Arguments:
BaseAddress - The base address for the new SYM tokens.
DestFileName - The destination file.
SourceFileName - The source file.
+ FileSize - Size of bin file.
Returns:
@@ -2185,7 +2188,7 @@ Returns:
CHAR8 Token[_MAX_PATH];
CHAR8 BaseToken[_MAX_PATH];
UINT64 TokenAddress;
- long StartLocation;
+ long StartLocation;
//
// Verify input parameters.
@@ -2275,13 +2278,20 @@ Returns:
// Get the token address
//
AsciiStringToUint64 (Address, TRUE, &TokenAddress);
+ if (TokenAddress > FileSize) {
+ //
+ // Symbol offset larger than FileSize. This Symbol can't be in Bin file. Don't print them.
+ //
+ break;
+ }
//
// Add the base address, the size of the FFS file header and the size of the peim header.
//
TokenAddress += BaseAddress &~IPF_CACHE_BIT;
- fprintf (DestFile, "%s | %016llX | %s | %s%s\n", Type, (unsigned long long) TokenAddress, Section, BaseToken, Token);
+ fprintf (DestFile, "%s | %016llX | ", Type, (unsigned long long) TokenAddress);
+ fprintf (DestFile, "%s | %s\n %s\n", Section, Token, BaseToken);
}
}
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.h b/BaseTools/Source/C/GenVtf/GenVtf.h
index eab14f3aa6..012ebb672a 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.h
+++ b/BaseTools/Source/C/GenVtf/GenVtf.h
@@ -205,7 +205,8 @@ EFI_STATUS
UpdateSymFile (
IN UINT64 BaseAddress,
IN CHAR8 *DestFileName,
- IN CHAR8 *SourceFileName
+ IN CHAR8 *SourceFileName,
+ IN UINT64 FileSize
)
/*++
@@ -219,6 +220,7 @@ Arguments:
BaseAddress - The base address for the new SYM tokens.
DestFileName - The destination file.
SourceFileName - The source file.
+ FileSize - Size of bin file.
Returns: