]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/ResetVector/Ia32/SearchForBfvBase.asm
e6ca6e6ffbb8825d0f25f2e49380590f2077a52e
[mirror_edk2.git] / OvmfPkg / ResetVector / Ia32 / SearchForBfvBase.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2008, Intel Corporation
4 ; All rights reserved. This program and the accompanying materials
5 ; are licensed and made available under the terms and conditions of the BSD License
6 ; which accompanies this distribution. The full text of the license may be found at
7 ; http://opensource.org/licenses/bsd-license.php
8 ;
9 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 ;
12 ; Module Name:
13 ;
14 ; SearchForBfvBase.asm
15 ;
16 ; Abstract:
17 ;
18 ; Search for the Boot FV Base Address
19 ;
20 ;------------------------------------------------------------------------------
21
22 ;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
23 ; { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } }
24 %define FFS_GUID_DWORD0 0x8c8ce578
25 %define FFS_GUID_DWORD1 0x4f1c8a3d
26 %define FFS_GUID_DWORD2 0x61893599
27 %define FFS_GUID_DWORD3 0xd32dc385
28
29 BITS 32
30
31 ;
32 ; Input:
33 ; None
34 ;
35 ; Output:
36 ; EBP - BFV Base Address
37 ;
38 ; Modified:
39 ; EAX, EBX
40 ;
41 Flat32SearchForBfvBase:
42
43 xor eax, eax
44 searchingForBfvHeaderLoop:
45 sub eax, 0x1000
46 cmp eax, 0xff800000
47 jb searchedForBfvHeaderButNotFound
48
49 ;
50 ; Check FFS GUID
51 ;
52 cmp dword [eax + 0x10], FFS_GUID_DWORD0
53 jne searchingForBfvHeaderLoop
54 cmp dword [eax + 0x14], FFS_GUID_DWORD1
55 jne searchingForBfvHeaderLoop
56 cmp dword [eax + 0x18], FFS_GUID_DWORD2
57 jne searchingForBfvHeaderLoop
58 cmp dword [eax + 0x1c], FFS_GUID_DWORD3
59 jne searchingForBfvHeaderLoop
60
61 ;
62 ; Check FV Length
63 ;
64 cmp dword [eax + 0x24], 0
65 jne searchingForBfvHeaderLoop
66 mov ebx, eax
67 add ebx, dword [eax + 0x20]
68 jnz searchingForBfvHeaderLoop
69
70 jmp searchedForBfvHeaderAndItWasFound
71
72 searchedForBfvHeaderButNotFound:
73 writeToSerialPort '!'
74 xor eax, eax
75
76 searchedForBfvHeaderAndItWasFound:
77 mov ebp, eax
78
79 writeToSerialPort 'B'
80 writeToSerialPort 'F'
81 writeToSerialPort 'V'
82 writeToSerialPort ' '
83
84 or ebp, ebp
85 jz $
86
87 OneTimeCallRet Flat32SearchForBfvBase
88