]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/FspSecCore/Ia32/FspHelper.asm
IntelFspPkg/FspSecCore add AsmGetFspBaseAddressNoStack and AsmGetFspInfoHeaderNoStack
[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 ; This program and the accompanying materials
6 ; are licensed and made available under the terms and conditions of the BSD License
7 ; which accompanies this distribution. The full text of the license may be found at
8 ; http://opensource.org/licenses/bsd-license.php.
9 ;
10 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 ;;
13
14 .586p
15 .model flat,C
16 .code
17
18 ;
19 ; FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
20 ; from the FSP Info header.
21 ;
22 FspInfoHeaderRelativeOff PROC NEAR PUBLIC
23 ;
24 ; This value will be pached by the build script
25 ;
26 DD 012345678h
27 FspInfoHeaderRelativeOff ENDP
28
29 ;
30 ; Returns FSP Base Address.
31 ;
32 ; This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
33 ;
34 AsmGetFspBaseAddress PROC NEAR PUBLIC
35 mov eax, AsmGetFspBaseAddress
36 sub eax, dword ptr [FspInfoHeaderRelativeOff]
37 add eax, 01Ch
38 mov eax, dword ptr [eax]
39 ret
40 AsmGetFspBaseAddress ENDP
41
42 ;
43 ; No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
44 ;
45 AsmGetFspBaseAddressNoStack PROC NEAR PUBLIC
46 mov eax, AsmGetFspBaseAddress
47 sub eax, dword ptr [FspInfoHeaderRelativeOff]
48 add eax, 01Ch
49 mov eax, dword ptr [eax]
50 jmp edi
51 AsmGetFspBaseAddressNoStack ENDP
52
53 ;
54 ; Returns FSP Info Header.
55 ;
56 ; This function gets the FSP Info Header using relative addressing and returns it
57 ;
58 AsmGetFspInfoHeader PROC NEAR PUBLIC
59 mov eax, AsmGetFspBaseAddress
60 sub eax, dword ptr [FspInfoHeaderRelativeOff]
61 ret
62 AsmGetFspInfoHeader ENDP
63
64 ;
65 ; No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
66 ;
67 AsmGetFspInfoHeaderNoStack PROC NEAR PUBLIC
68 mov eax, AsmGetFspBaseAddress
69 sub eax, dword ptr [FspInfoHeaderRelativeOff]
70 jmp edi
71 AsmGetFspInfoHeaderNoStack ENDP
72
73 END