summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/ResetVector/Ia32
diff options
context:
space:
mode:
Diffstat (limited to 'OvmfPkg/ResetVector/Ia32')
-rw-r--r--OvmfPkg/ResetVector/Ia32/32FlatTo64Flat.asm19
-rw-r--r--OvmfPkg/ResetVector/Ia32/SearchForBfvBase.asm50
-rw-r--r--OvmfPkg/ResetVector/Ia32/SearchForSecEntry.asm (renamed from OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm)94
3 files changed, 65 insertions, 98 deletions
diff --git a/OvmfPkg/ResetVector/Ia32/32FlatTo64Flat.asm b/OvmfPkg/ResetVector/Ia32/32FlatTo64Flat.asm
index f0528d4460..a97f9cc707 100644
--- a/OvmfPkg/ResetVector/Ia32/32FlatTo64Flat.asm
+++ b/OvmfPkg/ResetVector/Ia32/32FlatTo64Flat.asm
@@ -1,6 +1,8 @@
;------------------------------------------------------------------------------
+; @file
+; Transition from 32 bit flat protected mode into 64 bit flat protected mode
;
-; Copyright (c) 2008, Intel Corporation
+; Copyright (c) 2008 - 2009, 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
@@ -9,18 +11,13 @@
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
-; Module Name:
-;
-; 32FlatTo64Flat.asm
-;
-; Abstract:
-;
-; Transition from 32 bit flat protected mode into 64 bit flat protected mode
-;
;------------------------------------------------------------------------------
BITS 32
+;
+; Modified: EAX
+;
Transition32FlatTo64Flat:
mov eax, ((ADDR_OF_START_OF_RESET_CODE & ~0xfff) - 0x1000)
@@ -43,9 +40,7 @@ Transition32FlatTo64Flat:
BITS 64
jumpTo64BitAndLandHere:
- writeToSerialPort '6'
- writeToSerialPort '4'
- writeToSerialPort ' '
+ debugShowPostCode POSTCODE_64BIT_MODE
OneTimeCallRet Transition32FlatTo64Flat
diff --git a/OvmfPkg/ResetVector/Ia32/SearchForBfvBase.asm b/OvmfPkg/ResetVector/Ia32/SearchForBfvBase.asm
index e6ca6e6ffb..21b64f46e3 100644
--- a/OvmfPkg/ResetVector/Ia32/SearchForBfvBase.asm
+++ b/OvmfPkg/ResetVector/Ia32/SearchForBfvBase.asm
@@ -1,6 +1,8 @@
;------------------------------------------------------------------------------
+; @file
+; Search for the Boot Firmware Volume (BFV) base address
;
-; Copyright (c) 2008, Intel Corporation
+; Copyright (c) 2008 - 2009, 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
@@ -9,14 +11,6 @@
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
-; Module Name:
-;
-; SearchForBfvBase.asm
-;
-; Abstract:
-;
-; Search for the Boot FV Base Address
-;
;------------------------------------------------------------------------------
;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
@@ -29,21 +23,21 @@
BITS 32
;
-; Input:
-; None
+; Modified: EAX, EBX
+; Preserved: EDI, ESP
;
-; Output:
-; EBP - BFV Base Address
-;
-; Modified:
-; EAX, EBX
+; @param[out] EBP Address of Boot Firmware Volume (BFV)
;
Flat32SearchForBfvBase:
xor eax, eax
searchingForBfvHeaderLoop:
+ ;
+ ; We check for a firmware volume at every 4KB address in the top 16MB
+ ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)
+ ;
sub eax, 0x1000
- cmp eax, 0xff800000
+ cmp eax, 0xff000000
jb searchedForBfvHeaderButNotFound
;
@@ -70,19 +64,23 @@ searchingForBfvHeaderLoop:
jmp searchedForBfvHeaderAndItWasFound
searchedForBfvHeaderButNotFound:
- writeToSerialPort '!'
- xor eax, eax
+ ;
+ ; Hang if the SEC entry point was not found
+ ;
+ debugShowPostCode POSTCODE_BFV_NOT_FOUND
-searchedForBfvHeaderAndItWasFound:
+ ;
+ ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed
+ ; for debugging purposes.
+ ;
+ mov eax, 0xBFBFBFBF
mov ebp, eax
+ jmp $
- writeToSerialPort 'B'
- writeToSerialPort 'F'
- writeToSerialPort 'V'
- writeToSerialPort ' '
+searchedForBfvHeaderAndItWasFound:
+ mov ebp, eax
- or ebp, ebp
- jz $
+ debugShowPostCode POSTCODE_BFV_FOUND
OneTimeCallRet Flat32SearchForBfvBase
diff --git a/OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm b/OvmfPkg/ResetVector/Ia32/SearchForSecEntry.asm
index 9bb0cd1fa6..01d051918c 100644
--- a/OvmfPkg/ResetVector/Ia32/SearchForSecAndPeiEntries.asm
+++ b/OvmfPkg/ResetVector/Ia32/SearchForSecEntry.asm
@@ -1,6 +1,8 @@
;------------------------------------------------------------------------------
+; @file
+; Search for the SEC Core entry point
;
-; Copyright (c) 2008, Intel Corporation
+; Copyright (c) 2008 - 2009, 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
@@ -9,40 +11,26 @@
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
-; Module Name:
-;
-; SearchForSecAndPeiEntry.asm
-;
-; Abstract:
-;
-; Search for the SEC Core and PEI Core entry points
-;
;------------------------------------------------------------------------------
BITS 32
%define EFI_FV_FILETYPE_SECURITY_CORE 0x03
-%define EFI_FV_FILETYPE_PEI_CORE 0x04
;
-; Input:
-; EBP - BFV Base Address
+; Modified: EAX, EBX, ECX, EDX
+; Preserved: EDI, EBP, ESP
;
-; Output:
-; ESI - SEC Core Entry Point Address (or 0 if not found)
-; EDI - PEI Core Entry Point Address (or 0 if not found)
+; @param[in] EBP Address of Boot Firmware Volume (BFV)
+; @param[out] ESI SEC Core Entry Point Address
;
-; Modified:
-; EAX, EBX, ECX
-;
-Flat32SearchForSecAndPeiEntries:
+Flat32SearchForSecEntryPoint:
;
; Initialize EBP and ESI to 0
;
xor ebx, ebx
mov esi, ebx
- mov edi, ebx
;
; Pass over the BFV header
@@ -50,7 +38,7 @@ Flat32SearchForSecAndPeiEntries:
mov eax, ebp
mov bx, [ebp + 0x30]
add eax, ebx
- jc doneSeachingForSecAndPeiEntries
+ jc secEntryPointWasNotFound
jmp searchingForFfsFileHeaderLoop
@@ -59,17 +47,17 @@ moveForwardWhileSearchingForFfsFileHeaderLoop:
; Make forward progress in the search
;
inc eax
- jc doneSeachingForSecAndPeiEntries
+ jc secEntryPointWasNotFound
searchingForFfsFileHeaderLoop:
test eax, eax
- jz doneSeachingForSecAndPeiEntries
+ jz secEntryPointWasNotFound
;
; Ensure 8 byte alignment
;
add eax, 7
- jc doneSeachingForSecAndPeiEntries
+ jc secEntryPointWasNotFound
and al, 0xf8
;
@@ -82,7 +70,6 @@ searchingForFfsFileHeaderLoop:
and ecx, 0x00ffffff
or ecx, ecx
jz moveForwardWhileSearchingForFfsFileHeaderLoop
-; jmp $
add ecx, eax
jz jumpSinceWeFoundTheLastFfsFile
jc moveForwardWhileSearchingForFfsFileHeaderLoop
@@ -91,53 +78,41 @@ jumpSinceWeFoundTheLastFfsFile:
;
; There seems to be a valid file at eax
;
- mov bl, [eax + 0x12] ; BL - File Type
- cmp bl, EFI_FV_FILETYPE_PEI_CORE
- je fileTypeIsPeiCore
- cmp bl, EFI_FV_FILETYPE_SECURITY_CORE
+ cmp byte [eax + 0x12], EFI_FV_FILETYPE_SECURITY_CORE ; Check File Type
jne readyToTryFfsFileAtEcx
fileTypeIsSecCore:
- callEdx GetEntryPointOfFfsFileReturnEdx
- test eax, eax
- jz readyToTryFfsFileAtEcx
-
- mov esi, eax
- jmp readyToTryFfsFileAtEcx
-
-fileTypeIsPeiCore:
- callEdx GetEntryPointOfFfsFileReturnEdx
+ OneTimeCall GetEntryPointOfFfsFile
test eax, eax
- jz readyToTryFfsFileAtEcx
-
- mov edi, eax
+ jnz doneSeachingForSecEntryPoint
readyToTryFfsFileAtEcx:
+ ;
+ ; Try the next FFS file at ECX
+ ;
mov eax, ecx
jmp searchingForFfsFileHeaderLoop
-doneSeachingForSecAndPeiEntries:
+secEntryPointWasNotFound:
+ xor eax, eax
+
+doneSeachingForSecEntryPoint:
+ mov esi, eax
test esi, esi
jnz secCoreEntryPointWasFound
- writeToSerialPort '!'
-secCoreEntryPointWasFound:
- writeToSerialPort 'S'
- writeToSerialPort 'E'
- writeToSerialPort 'C'
- writeToSerialPort ' '
- test edi, edi
- jnz peiCoreEntryPointWasFound
- writeToSerialPort '!'
-peiCoreEntryPointWasFound:
- writeToSerialPort 'P'
- writeToSerialPort 'E'
- writeToSerialPort 'I'
- writeToSerialPort ' '
+secCoreEntryPointWasNotFound:
+ ;
+ ; Hang if the SEC entry point was not found
+ ;
+ debugShowPostCode POSTCODE_SEC_NOT_FOUND
+ jz $
- OneTimeCallRet Flat32SearchForSecAndPeiEntries
+secCoreEntryPointWasFound:
+ debugShowPostCode POSTCODE_SEC_FOUND
+ OneTimeCallRet Flat32SearchForSecEntryPoint
%define EFI_SECTION_PE32 0x10
@@ -152,7 +127,7 @@ peiCoreEntryPointWasFound:
; Modified:
; EBX
;
-GetEntryPointOfFfsFileReturnEdx:
+GetEntryPointOfFfsFile:
test eax, eax
jz getEntryPointOfFfsFileErrorReturn
add eax, 0x18 ; EAX = Start of section
@@ -217,6 +192,5 @@ getEntryPointOfFfsFileErrorReturn:
mov eax, 0
getEntryPointOfFfsFileReturn:
- jmp edx
-
+ OneTimeCallRet GetEntryPointOfFfsFile