1 ;------------------------------------------------------------------------------
3 ; Search for the Boot Firmware Volume (BFV) base address
5 ; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>
6 ; SPDX-License-Identifier: BSD-2-Clause-Patent
8 ;------------------------------------------------------------------------------
10 ;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
11 ; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }
12 %define FFS_GUID_DWORD0 0x8c8ce578
13 %define FFS_GUID_DWORD1 0x4f1c8a3d
14 %define FFS_GUID_DWORD2 0x61893599
15 %define FFS_GUID_DWORD3 0xd32dc385
23 ; @param[out] EBP Address of Boot Firmware Volume (BFV)
25 Flat32SearchForBfvBase:
28 searchingForBfvHeaderLoop:
30 ; We check for a firmware volume at every 4KB address in the top 16MB
31 ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)
35 jb searchedForBfvHeaderButNotFound
40 cmp dword [eax + 0x10], FFS_GUID_DWORD0
41 jne searchingForBfvHeaderLoop
42 cmp dword [eax + 0x14], FFS_GUID_DWORD1
43 jne searchingForBfvHeaderLoop
44 cmp dword [eax + 0x18], FFS_GUID_DWORD2
45 jne searchingForBfvHeaderLoop
46 cmp dword [eax + 0x1c], FFS_GUID_DWORD3
47 jne searchingForBfvHeaderLoop
52 cmp dword [eax + 0x24], 0
53 jne searchingForBfvHeaderLoop
55 add ebx, dword [eax + 0x20]
56 jnz searchingForBfvHeaderLoop
58 jmp searchedForBfvHeaderAndItWasFound
60 searchedForBfvHeaderButNotFound:
62 ; Hang if the SEC entry point was not found
64 debugShowPostCode POSTCODE_BFV_NOT_FOUND
67 ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed
68 ; for debugging purposes.
74 searchedForBfvHeaderAndItWasFound:
77 debugShowPostCode POSTCODE_BFV_FOUND
79 OneTimeCallRet Flat32SearchForBfvBase