diff options
author | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-10-07 16:01:06 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-10-07 16:01:06 +0000 |
commit | 9337cf8c99c503d7c13e901ea605e460fb836393 (patch) | |
tree | 08e6ef0a8582d2ce32adb4844d7fdad29d546a61 /OvmfPkg | |
parent | d7576cf9b64190f0aa29e9eacc956eb582c284eb (diff) | |
download | edk2-9337cf8c99c503d7c13e901ea605e460fb836393.zip edk2-9337cf8c99c503d7c13e901ea605e460fb836393.tar.gz edk2-9337cf8c99c503d7c13e901ea605e460fb836393.tar.bz2 |
OVMF SEC: Modify to search sections of FFS file for PE32 image.
Previously the code would expect that the PE32 image was in the
first section of the FFS file. This might not be the case if the
PE32 section is forced to be aligned.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9331 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg')
-rw-r--r-- | OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw | bin | 852 -> 884 bytes | |||
-rw-r--r-- | OvmfPkg/ResetVector/Bin/ResetVector.x64.raw | bin | 28676 -> 28676 bytes | |||
-rw-r--r-- | OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm | 29 |
3 files changed, 26 insertions, 3 deletions
diff --git a/OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw b/OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw Binary files differindex e68e75d..76286b9 100644 --- a/OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw +++ b/OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw diff --git a/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw b/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw Binary files differindex 94bb3e2..adf44b1 100644 --- a/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw +++ b/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw diff --git a/OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm b/OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm index b4f734f..9bb0cd1 100644 --- a/OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm +++ b/OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm @@ -144,6 +144,7 @@ peiCoreEntryPointWasFound: ;
; Input:
; EAX - Start of FFS file
+; ECX - End of FFS file
;
; Output:
; EAX - Entry point of PE32 (or 0 if not found)
@@ -154,11 +155,33 @@ peiCoreEntryPointWasFound: GetEntryPointOfFfsFileReturnEdx:
test eax, eax
jz getEntryPointOfFfsFileErrorReturn
+ add eax, 0x18 ; EAX = Start of section
- cmp byte [eax + 0x1b], EFI_SECTION_PE32
- jne getEntryPointOfFfsFileErrorReturn
+getEntryPointOfFfsFileLoopForSections:
+ cmp eax, ecx
+ jae getEntryPointOfFfsFileErrorReturn
+
+ cmp byte [eax + 3], EFI_SECTION_PE32
+ je getEntryPointOfFfsFileFoundPe32Section
+
+ ;
+ ; The section type was not PE32, so move to next section
+ ;
+ mov ebx, dword [eax]
+ and ebx, 0x00ffffff
+ add eax, ebx
+ jc getEntryPointOfFfsFileErrorReturn
+
+ ;
+ ; Ensure that FFS section is 32-bit aligned
+ ;
+ add eax, 3
+ jc getEntryPointOfFfsFileErrorReturn
+ and al, 0xfc
+ jmp getEntryPointOfFfsFileLoopForSections
- add eax, 0x1c ; EAX = Start of PE32 image
+getEntryPointOfFfsFileFoundPe32Section:
+ add eax, 4 ; EAX = Start of PE32 image
mov ebx, eax
cmp word [eax], 'MZ'
|