summaryrefslogtreecommitdiffstats
path: root/IntelFsp2Pkg
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFsp2Pkg')
-rw-r--r--IntelFsp2Pkg/Tools/SplitFspBin.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/IntelFsp2Pkg/Tools/SplitFspBin.py b/IntelFsp2Pkg/Tools/SplitFspBin.py
index 3c0d5af1b6..24272e82af 100644
--- a/IntelFsp2Pkg/Tools/SplitFspBin.py
+++ b/IntelFsp2Pkg/Tools/SplitFspBin.py
@@ -677,8 +677,12 @@ class PeTeImage:
else:
offset = self.Offset + self.DosHdr.e_lfanew
offset += EFI_IMAGE_NT_HEADERS32.OptionalHeader.offset
- offset += EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.offset
- size = EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.size
+ if self.PeHdr.OptionalHeader.PePlusOptHdr.Magic == 0x20b: # PE32+ image
+ offset += EFI_IMAGE_OPTIONAL_HEADER32_PLUS.ImageBase.offset
+ size = EFI_IMAGE_OPTIONAL_HEADER32_PLUS.ImageBase.size
+ else:
+ offset += EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.offset
+ size = EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.size
value = Bytes2Val(fdbin[offset:offset+size]) + delta
fdbin[offset:offset+size] = Val2Bytes(value, size)