1 ;------------------------------------------------------------------------------
3 ; Search for the Boot Firmware Volume (BFV) base address
5 ; Copyright (c) 2008 - 2009, Intel Corporation
6 ; All rights reserved. This program and the accompanying materials
7 ; are licensed and made available under the terms and conditions of the BSD License
8 ; which accompanies this distribution. The full text of the license may be found at
9 ; http://opensource.org/licenses/bsd-license.php
11 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 ;------------------------------------------------------------------------------
16 ;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
17 ; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }
18 %define FFS_GUID_DWORD0 0x8c8ce578
19 %define FFS_GUID_DWORD1 0x4f1c8a3d
20 %define FFS_GUID_DWORD2 0x61893599
21 %define FFS_GUID_DWORD3 0xd32dc385
29 ; @param[out] EBP Address of Boot Firmware Volume (BFV)
31 Flat32SearchForBfvBase:
34 searchingForBfvHeaderLoop:
36 ; We check for a firmware volume at every 4KB address in the top 16MB
37 ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)
41 jb searchedForBfvHeaderButNotFound
46 cmp dword [eax + 0x10], FFS_GUID_DWORD0
47 jne searchingForBfvHeaderLoop
48 cmp dword [eax + 0x14], FFS_GUID_DWORD1
49 jne searchingForBfvHeaderLoop
50 cmp dword [eax + 0x18], FFS_GUID_DWORD2
51 jne searchingForBfvHeaderLoop
52 cmp dword [eax + 0x1c], FFS_GUID_DWORD3
53 jne searchingForBfvHeaderLoop
58 cmp dword [eax + 0x24], 0
59 jne searchingForBfvHeaderLoop
61 add ebx, dword [eax + 0x20]
62 jnz searchingForBfvHeaderLoop
64 jmp searchedForBfvHeaderAndItWasFound
66 searchedForBfvHeaderButNotFound:
68 ; Hang if the SEC entry point was not found
70 debugShowPostCode POSTCODE_BFV_NOT_FOUND
73 ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed
74 ; for debugging purposes.
80 searchedForBfvHeaderAndItWasFound:
83 debugShowPostCode POSTCODE_BFV_FOUND
85 OneTimeCallRet Flat32SearchForBfvBase