diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw
index ec6bcfd48b..2c6ff655de 100644
Binary files a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw and b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.port80.raw differ
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw
index 02cb66c848..e34780a3a2 100644
Binary files a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw and b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.raw differ
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw
index 58542ad9d1..6dfa68eabb 100644
Binary files a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw and b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.ia32.serial.raw differ
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw
index 393b6ef2ca..6c0bcc47eb 100644
Binary files a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw and b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.port80.raw differ
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw
index 7ab1161a21..a78d5b407c 100644
Binary files a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw and b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.raw differ
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw
index f32e81ac12..61c71349a8 100644
Binary files a/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw and b/UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.x64.serial.raw differ
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForSecEntry.asm b/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForSecEntry.asm
index 9558b9d350..6206b44485 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForSecEntry.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForSecEntry.asm
@@ -2,7 +2,7 @@
; @file
; Search for the SEC Core entry point
;
-; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.
+; Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -115,6 +115,7 @@ secCoreEntryPointWasFound:
OneTimeCallRet Flat32SearchForSecEntryPoint
%define EFI_SECTION_PE32 0x10
+%define EFI_SECTION_TE 0x12
;
; Input:
@@ -139,8 +140,11 @@ getEntryPointOfFfsFileLoopForSections:
cmp byte [eax + 3], EFI_SECTION_PE32
je getEntryPointOfFfsFileFoundPe32Section
+ cmp byte [eax + 3], EFI_SECTION_TE
+ je getEntryPointOfFfsFileFoundTeSection
+
;
- ; The section type was not PE32, so move to next section
+ ; The section type was not PE32 or TE, so move to next section
;
mov ebx, dword [eax]
and ebx, 0x00ffffff
@@ -158,26 +162,10 @@ getEntryPointOfFfsFileLoopForSections:
getEntryPointOfFfsFileFoundPe32Section:
add eax, 4 ; EAX = Start of PE32 image
- mov ebx, eax
cmp word [eax], 'MZ'
- jne thereIsNotAnMzSignature
+ jne getEntryPointOfFfsFileErrorReturn
movzx ebx, word [eax + 0x3c]
add ebx, eax
-thereIsNotAnMzSignature:
-
- ; if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE)
- cmp word [ebx], 'VZ'
- jne thereIsNoVzSignature
- ; *EntryPoint = (VOID *)((UINTN)Pe32Data +
- ; (UINTN)(Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) +
- ; sizeof(EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
- add eax, [ebx + 0x8]
- add eax, 0x28
- movzx ebx, word [ebx + 0x6]
- sub eax, ebx
- jmp getEntryPointOfFfsFileReturn
-
-thereIsNoVzSignature:
; if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)
cmp dword [ebx], `PE\x00\x00`
@@ -188,6 +176,22 @@ thereIsNoVzSignature:
add eax, [ebx + 0x4 + 0x14 + 0x10]
jmp getEntryPointOfFfsFileReturn
+getEntryPointOfFfsFileFoundTeSection:
+ add eax, 4 ; EAX = Start of TE image
+ mov ebx, eax
+
+ ; if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE)
+ cmp word [ebx], 'VZ'
+ jne getEntryPointOfFfsFileErrorReturn
+ ; *EntryPoint = (VOID *)((UINTN)Pe32Data +
+ ; (UINTN)(Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) +
+ ; sizeof(EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
+ add eax, [ebx + 0x8]
+ add eax, 0x28
+ movzx ebx, word [ebx + 0x6]
+ sub eax, ebx
+ jmp getEntryPointOfFfsFileReturn
+
getEntryPointOfFfsFileErrorReturn:
mov eax, 0