]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OVMF SEC: Modify to search sections of FFS file for PE32 image.
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 7 Oct 2009 16:01:06 +0000 (16:01 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 7 Oct 2009 16:01:06 +0000 (16:01 +0000)
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

OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw
OvmfPkg/ResetVector/Bin/ResetVector.x64.raw
OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm

index e68e75d19e407e18cf7ca6b29d34fa59465d67fc..76286b9fa3c49e96543042703f424cc2004062d4 100644 (file)
Binary files a/OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw and b/OvmfPkg/ResetVector/Bin/ResetVector.ia32.raw differ
index 94bb3e269eedd2e6920d30cd11c0f6d84615727c..adf44b10286bc4ec4ab35ffbd2d325889a19096c 100644 (file)
Binary files a/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw and b/OvmfPkg/ResetVector/Bin/ResetVector.x64.raw differ
index b4f734fb760491102381251d4ca984fa955a80d5..9bb0cd1fa6c8ab802217b94930dfbc1ccfc07430 100644 (file)
@@ -144,6 +144,7 @@ peiCoreEntryPointWasFound:
 ;\r
 ; Input:\r
 ;   EAX - Start of FFS file\r
+;   ECX - End of FFS file\r
 ;\r
 ; Output:\r
 ;   EAX - Entry point of PE32 (or 0 if not found)\r
@@ -154,11 +155,33 @@ peiCoreEntryPointWasFound:
 GetEntryPointOfFfsFileReturnEdx:\r
     test    eax, eax\r
     jz      getEntryPointOfFfsFileErrorReturn\r
+    add     eax, 0x18       ; EAX = Start of section\r
 \r
-    cmp     byte [eax + 0x1b], EFI_SECTION_PE32\r
-    jne     getEntryPointOfFfsFileErrorReturn\r
+getEntryPointOfFfsFileLoopForSections:\r
+    cmp     eax, ecx\r
+    jae     getEntryPointOfFfsFileErrorReturn\r
+\r
+    cmp     byte [eax + 3], EFI_SECTION_PE32\r
+    je      getEntryPointOfFfsFileFoundPe32Section\r
+\r
+    ;\r
+    ; The section type was not PE32, so move to next section\r
+    ;\r
+    mov     ebx, dword [eax]\r
+    and     ebx, 0x00ffffff\r
+    add     eax, ebx\r
+    jc      getEntryPointOfFfsFileErrorReturn\r
+\r
+    ;\r
+    ; Ensure that FFS section is 32-bit aligned\r
+    ;\r
+    add     eax, 3\r
+    jc      getEntryPointOfFfsFileErrorReturn\r
+    and     al, 0xfc\r
+    jmp     getEntryPointOfFfsFileLoopForSections\r
 \r
-    add     eax, 0x1c       ; EAX = Start of PE32 image\r
+getEntryPointOfFfsFileFoundPe32Section:\r
+    add     eax, 4       ; EAX = Start of PE32 image\r
 \r
     mov     ebx, eax\r
     cmp     word [eax], 'MZ'\r