]>
Commit | Line | Data |
---|---|---|
bc252e8e EB |
1 | ;------------------------------------------------------------------------------\r |
2 | ; @file\r | |
3 | ; Search for the Boot Firmware Volume (BFV) base address\r | |
4 | ;\r | |
01a1c0fc | 5 | ; Copyright (c) 2008 - 2009, Intel Corporation. All rights reserved.<BR>\r |
0acd8697 | 6 | ; SPDX-License-Identifier: BSD-2-Clause-Patent\r |
bc252e8e EB |
7 | ;\r |
8 | ;------------------------------------------------------------------------------\r | |
9 | \r | |
10 | ;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \\r | |
11 | ; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }\r | |
12 | %define FFS_GUID_DWORD0 0x8c8ce578\r | |
13 | %define FFS_GUID_DWORD1 0x4f1c8a3d\r | |
14 | %define FFS_GUID_DWORD2 0x61893599\r | |
15 | %define FFS_GUID_DWORD3 0xd32dc385\r | |
16 | \r | |
17 | BITS 32\r | |
18 | \r | |
19 | ;\r | |
20 | ; Modified: EAX, EBX\r | |
21 | ; Preserved: EDI, ESP\r | |
22 | ;\r | |
23 | ; @param[out] EBP Address of Boot Firmware Volume (BFV)\r | |
24 | ;\r | |
25 | Flat32SearchForBfvBase:\r | |
26 | \r | |
27 | xor eax, eax\r | |
28 | searchingForBfvHeaderLoop:\r | |
29 | ;\r | |
30 | ; We check for a firmware volume at every 4KB address in the top 16MB\r | |
31 | ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)\r | |
32 | ;\r | |
33 | sub eax, 0x1000\r | |
34 | cmp eax, 0xff000000\r | |
35 | jb searchedForBfvHeaderButNotFound\r | |
36 | \r | |
37 | ;\r | |
38 | ; Check FFS GUID\r | |
39 | ;\r | |
40 | cmp dword [eax + 0x10], FFS_GUID_DWORD0\r | |
41 | jne searchingForBfvHeaderLoop\r | |
42 | cmp dword [eax + 0x14], FFS_GUID_DWORD1\r | |
43 | jne searchingForBfvHeaderLoop\r | |
44 | cmp dword [eax + 0x18], FFS_GUID_DWORD2\r | |
45 | jne searchingForBfvHeaderLoop\r | |
46 | cmp dword [eax + 0x1c], FFS_GUID_DWORD3\r | |
47 | jne searchingForBfvHeaderLoop\r | |
48 | \r | |
49 | ;\r | |
50 | ; Check FV Length\r | |
51 | ;\r | |
52 | cmp dword [eax + 0x24], 0\r | |
53 | jne searchingForBfvHeaderLoop\r | |
54 | mov ebx, eax\r | |
55 | add ebx, dword [eax + 0x20]\r | |
56 | jnz searchingForBfvHeaderLoop\r | |
57 | \r | |
58 | jmp searchedForBfvHeaderAndItWasFound\r | |
59 | \r | |
60 | searchedForBfvHeaderButNotFound:\r | |
61 | ;\r | |
62 | ; Hang if the SEC entry point was not found\r | |
63 | ;\r | |
64 | debugShowPostCode POSTCODE_BFV_NOT_FOUND\r | |
65 | \r | |
66 | ;\r | |
67 | ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed\r | |
68 | ; for debugging purposes.\r | |
69 | ;\r | |
70 | mov eax, 0xBFBFBFBF\r | |
71 | mov ebp, eax\r | |
72 | jmp $\r | |
73 | \r | |
74 | searchedForBfvHeaderAndItWasFound:\r | |
75 | mov ebp, eax\r | |
76 | \r | |
77 | debugShowPostCode POSTCODE_BFV_FOUND\r | |
78 | \r | |
79 | OneTimeCallRet Flat32SearchForBfvBase\r | |
80 | \r |