]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/FspSecCore/Ia32/FspHelper.s
IntelFspPkg/FspSecCore add AsmGetFspBaseAddressNoStack and AsmGetFspInfoHeaderNoStack
[mirror_edk2.git] / IntelFspPkg / FspSecCore / Ia32 / FspHelper.s
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
4 # 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 # Abstract:
13 #
14 # Provide FSP helper function.
15 #
16 #------------------------------------------------------------------------------
17
18 #
19 # FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
20 # from the FSP Info header.
21 #
22 ASM_GLOBAL ASM_PFX(FspInfoHeaderRelativeOff)
23 ASM_PFX(FspInfoHeaderRelativeOff):
24 #
25 # This value will be pached by the build script
26 #
27 .long 0x012345678
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 ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddress)
35 ASM_PFX(AsmGetFspBaseAddress):
36 mov $AsmGetFspBaseAddress, %eax
37 sub FspInfoHeaderRelativeOff, %eax
38 add $0x01C, %eax
39 mov (%eax), %eax
40 ret
41
42 #
43 # No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
44 #
45 ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddressNoStack)
46 ASM_PFX(AsmGetFspBaseAddressNoStack):
47 mov $AsmGetFspBaseAddress, %eax
48 sub FspInfoHeaderRelativeOff, %eax
49 add $0x01C, %eax
50 mov (%eax), %eax
51 jmp *%edi
52
53 #
54 # Returns FSP Info Header.
55 #
56 # This function gets the FSP Info Header using relative addressing and returns it
57 #
58 ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeader)
59 ASM_PFX(AsmGetFspInfoHeader):
60 mov $AsmGetFspBaseAddress, %eax
61 sub FspInfoHeaderRelativeOff, %eax
62 ret
63
64 #
65 # No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
66 #
67 ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeaderNoStack)
68 ASM_PFX(AsmGetFspInfoHeaderNoStack):
69 mov $AsmGetFspBaseAddress, %eax
70 sub FspInfoHeaderRelativeOff, %eax
71 jmp *%edi