]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
9e6799d1d3227c5d0bdb6c15cec85439b30ed09f
[mirror_edk2.git] / IntelFspPkg / FspSecCore / Ia32 / FspHelper.asm
1 ;; @file
2 ; Provide FSP helper function.
3 ;
4 ; Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 ; SPDX-License-Identifier: BSD-2-Clause-Patent
6 ;;
7
8 .586p
9 .model flat,C
10 .code
11
12 ;
13 ; FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
14 ; from the FSP Info header.
15 ;
16 FspInfoHeaderRelativeOff PROC NEAR PUBLIC
17 ;
18 ; This value will be pached by the build script
19 ;
20 DD 012345678h
21 FspInfoHeaderRelativeOff ENDP
22
23 ;
24 ; Returns FSP Base Address.
25 ;
26 ; This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
27 ;
28 AsmGetFspBaseAddress PROC NEAR PUBLIC
29 mov eax, AsmGetFspBaseAddress
30 sub eax, dword ptr [FspInfoHeaderRelativeOff]
31 add eax, 01Ch
32 mov eax, dword ptr [eax]
33 ret
34 AsmGetFspBaseAddress ENDP
35
36 ;
37 ; No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
38 ;
39 AsmGetFspBaseAddressNoStack PROC NEAR PUBLIC
40 mov eax, AsmGetFspBaseAddress
41 sub eax, dword ptr [FspInfoHeaderRelativeOff]
42 add eax, 01Ch
43 mov eax, dword ptr [eax]
44 jmp edi
45 AsmGetFspBaseAddressNoStack ENDP
46
47 ;
48 ; Returns FSP Info Header.
49 ;
50 ; This function gets the FSP Info Header using relative addressing and returns it
51 ;
52 AsmGetFspInfoHeader PROC NEAR PUBLIC
53 mov eax, AsmGetFspBaseAddress
54 sub eax, dword ptr [FspInfoHeaderRelativeOff]
55 ret
56 AsmGetFspInfoHeader ENDP
57
58 ;
59 ; No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
60 ;
61 AsmGetFspInfoHeaderNoStack PROC NEAR PUBLIC
62 mov eax, AsmGetFspBaseAddress
63 sub eax, dword ptr [FspInfoHeaderRelativeOff]
64 jmp edi
65 AsmGetFspInfoHeaderNoStack ENDP
66
67 END