;------------------------------------------------------------------------------\r
+; @file\r
+; Search for the Boot Firmware Volume (BFV) base address\r
;\r
-; Copyright (c) 2008, Intel Corporation\r
+; Copyright (c) 2008 - 2009, Intel Corporation\r
; All rights reserved. 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
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
;\r
-; Module Name:\r
-;\r
-; SearchForBfvBase.asm\r
-;\r
-; Abstract:\r
-;\r
-; Search for the Boot FV Base Address\r
-;\r
;------------------------------------------------------------------------------\r
\r
;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \\r
BITS 32\r
\r
;\r
-; Input:\r
-; None\r
+; Modified: EAX, EBX\r
+; Preserved: EDI, ESP\r
;\r
-; Output:\r
-; EBP - BFV Base Address\r
-;\r
-; Modified:\r
-; EAX, EBX\r
+; @param[out] EBP Address of Boot Firmware Volume (BFV)\r
;\r
Flat32SearchForBfvBase:\r
\r
xor eax, eax\r
searchingForBfvHeaderLoop:\r
+ ;\r
+ ; We check for a firmware volume at every 4KB address in the top 16MB\r
+ ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)\r
+ ;\r
sub eax, 0x1000\r
- cmp eax, 0xff800000\r
+ cmp eax, 0xff000000\r
jb searchedForBfvHeaderButNotFound\r
\r
;\r
jmp searchedForBfvHeaderAndItWasFound\r
\r
searchedForBfvHeaderButNotFound:\r
- writeToSerialPort '!'\r
- xor eax, eax\r
+ ;\r
+ ; Hang if the SEC entry point was not found\r
+ ;\r
+ debugShowPostCode POSTCODE_BFV_NOT_FOUND\r
\r
-searchedForBfvHeaderAndItWasFound:\r
+ ;\r
+ ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed\r
+ ; for debugging purposes.\r
+ ;\r
+ mov eax, 0xBFBFBFBF\r
mov ebp, eax\r
+ jmp $\r
\r
- writeToSerialPort 'B'\r
- writeToSerialPort 'F'\r
- writeToSerialPort 'V'\r
- writeToSerialPort ' '\r
+searchedForBfvHeaderAndItWasFound:\r
+ mov ebp, eax\r
\r
- or ebp, ebp\r
- jz $\r
+ debugShowPostCode POSTCODE_BFV_FOUND\r
\r
OneTimeCallRet Flat32SearchForBfvBase\r
\r