]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForSecEntry.asm
UefiCpuPkg VTF0: Fix support for finding SEC image of type TE.
[mirror_edk2.git] / UefiCpuPkg / ResetVector / Vtf0 / Ia32 / SearchForSecEntry.asm
index 9558b9d3506786296b464953048208aeff047e34..6206b44485e7658980d58c0c4b51244ffdb71992 100644 (file)
@@ -2,7 +2,7 @@
 ; @file\r
 ; Search for the SEC Core entry point\r
 ;\r
-; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -115,6 +115,7 @@ secCoreEntryPointWasFound:
     OneTimeCallRet Flat32SearchForSecEntryPoint\r
 \r
 %define EFI_SECTION_PE32                  0x10\r
+%define EFI_SECTION_TE                    0x12\r
 \r
 ;\r
 ; Input:\r
@@ -139,8 +140,11 @@ getEntryPointOfFfsFileLoopForSections:
     cmp     byte [eax + 3], EFI_SECTION_PE32\r
     je      getEntryPointOfFfsFileFoundPe32Section\r
 \r
+    cmp     byte [eax + 3], EFI_SECTION_TE\r
+    je      getEntryPointOfFfsFileFoundTeSection\r
+\r
     ;\r
-    ; The section type was not PE32, so move to next section\r
+    ; The section type was not PE32 or TE, so move to next section\r
     ;\r
     mov     ebx, dword [eax]\r
     and     ebx, 0x00ffffff\r
@@ -158,16 +162,27 @@ getEntryPointOfFfsFileLoopForSections:
 getEntryPointOfFfsFileFoundPe32Section:\r
     add     eax, 4       ; EAX = Start of PE32 image\r
 \r
-    mov     ebx, eax\r
     cmp     word [eax], 'MZ'\r
-    jne     thereIsNotAnMzSignature\r
+    jne     getEntryPointOfFfsFileErrorReturn\r
     movzx   ebx, word [eax + 0x3c]\r
     add     ebx, eax\r
-thereIsNotAnMzSignature:\r
+\r
+    ; if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)\r
+    cmp     dword [ebx], `PE\x00\x00`\r
+    jne     getEntryPointOfFfsFileErrorReturn\r
+\r
+    ; *EntryPoint = (VOID *)((UINTN)Pe32Data +\r
+    ;   (UINTN)(Hdr.Pe32->OptionalHeader.AddressOfEntryPoint & 0x0ffffffff));\r
+    add     eax, [ebx + 0x4 + 0x14 + 0x10]\r
+    jmp     getEntryPointOfFfsFileReturn\r
+\r
+getEntryPointOfFfsFileFoundTeSection:\r
+    add     eax, 4       ; EAX = Start of TE image\r
+    mov     ebx, eax\r
 \r
     ; if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE)\r
     cmp     word [ebx], 'VZ'\r
-    jne     thereIsNoVzSignature\r
+    jne     getEntryPointOfFfsFileErrorReturn\r
     ; *EntryPoint = (VOID *)((UINTN)Pe32Data +\r
     ;   (UINTN)(Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) +\r
     ;   sizeof(EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);\r
@@ -177,17 +192,6 @@ thereIsNotAnMzSignature:
     sub     eax, ebx\r
     jmp     getEntryPointOfFfsFileReturn\r
 \r
-thereIsNoVzSignature:\r
-\r
-    ; if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)\r
-    cmp     dword [ebx], `PE\x00\x00`\r
-    jne     getEntryPointOfFfsFileErrorReturn\r
-\r
-    ; *EntryPoint = (VOID *)((UINTN)Pe32Data +\r
-    ;   (UINTN)(Hdr.Pe32->OptionalHeader.AddressOfEntryPoint & 0x0ffffffff));\r
-    add     eax, [ebx + 0x4 + 0x14 + 0x10]\r
-    jmp     getEntryPointOfFfsFileReturn\r
-\r
 getEntryPointOfFfsFileErrorReturn:\r
     mov     eax, 0\r
 \r