]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/ResetVector/Ia32/SearchForBfvBase.asm
OVMF ResetVector: Modify interface with SEC module
[mirror_edk2.git] / OvmfPkg / ResetVector / Ia32 / SearchForBfvBase.asm
CommitLineData
49ba9447 1;------------------------------------------------------------------------------\r
7a55c43b 2; @file\r
3; Search for the Boot Firmware Volume (BFV) base address\r
49ba9447 4;\r
7a55c43b 5; Copyright (c) 2008 - 2009, Intel Corporation\r
49ba9447 6; All rights reserved. This program and the accompanying materials\r
7; are licensed and made available under the terms and conditions of the BSD License\r
8; which accompanies this distribution. The full text of the license may be found at\r
9; http://opensource.org/licenses/bsd-license.php\r
10;\r
11; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13;\r
49ba9447 14;------------------------------------------------------------------------------\r
15\r
16;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \\r
17; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }\r
18%define FFS_GUID_DWORD0 0x8c8ce578\r
19%define FFS_GUID_DWORD1 0x4f1c8a3d\r
20%define FFS_GUID_DWORD2 0x61893599\r
21%define FFS_GUID_DWORD3 0xd32dc385\r
22\r
23BITS 32\r
24\r
25;\r
7a55c43b 26; Modified: EAX, EBX\r
27; Preserved: EDI, ESP\r
49ba9447 28;\r
7a55c43b 29; @param[out] EBP Address of Boot Firmware Volume (BFV)\r
49ba9447 30;\r
31Flat32SearchForBfvBase:\r
32\r
33 xor eax, eax\r
34searchingForBfvHeaderLoop:\r
7a55c43b 35 ;\r
36 ; We check for a firmware volume at every 4KB address in the top 16MB\r
37 ; just below 4GB. (Addresses at 0xffHHH000 where H is any hex digit.)\r
38 ;\r
49ba9447 39 sub eax, 0x1000\r
7a55c43b 40 cmp eax, 0xff000000\r
49ba9447 41 jb searchedForBfvHeaderButNotFound\r
42\r
43 ;\r
44 ; Check FFS GUID\r
45 ;\r
46 cmp dword [eax + 0x10], FFS_GUID_DWORD0\r
47 jne searchingForBfvHeaderLoop\r
48 cmp dword [eax + 0x14], FFS_GUID_DWORD1\r
49 jne searchingForBfvHeaderLoop\r
50 cmp dword [eax + 0x18], FFS_GUID_DWORD2\r
51 jne searchingForBfvHeaderLoop\r
52 cmp dword [eax + 0x1c], FFS_GUID_DWORD3\r
53 jne searchingForBfvHeaderLoop\r
54\r
55 ;\r
56 ; Check FV Length\r
57 ;\r
58 cmp dword [eax + 0x24], 0\r
59 jne searchingForBfvHeaderLoop\r
60 mov ebx, eax\r
61 add ebx, dword [eax + 0x20]\r
62 jnz searchingForBfvHeaderLoop\r
63\r
64 jmp searchedForBfvHeaderAndItWasFound\r
65\r
66searchedForBfvHeaderButNotFound:\r
7a55c43b 67 ;\r
68 ; Hang if the SEC entry point was not found\r
69 ;\r
70 debugShowPostCode POSTCODE_BFV_NOT_FOUND\r
49ba9447 71\r
7a55c43b 72 ;\r
73 ; 0xbfbfbfbf in the EAX & EBP registers helps signal what failed\r
74 ; for debugging purposes.\r
75 ;\r
76 mov eax, 0xBFBFBFBF\r
49ba9447 77 mov ebp, eax\r
7a55c43b 78 jmp $\r
49ba9447 79\r
7a55c43b 80searchedForBfvHeaderAndItWasFound:\r
81 mov ebp, eax\r
49ba9447 82\r
7a55c43b 83 debugShowPostCode POSTCODE_BFV_FOUND\r
49ba9447 84\r
85 OneTimeCallRet Flat32SearchForBfvBase\r
86\r