]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFsp2Pkg/FspSecCore/Ia32/FspHelper.nasm
IntelFsp2Pkg/FspSecCore: Make FSP functions position independent
[mirror_edk2.git] / IntelFsp2Pkg / FspSecCore / Ia32 / FspHelper.nasm
CommitLineData
cf1d4549
JY
1;; @file\r
2; Provide FSP helper function.\r
3;\r
4; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
5; This program and the accompanying materials\r
6; are licensed and made available under the terms and conditions of the BSD License\r
7; which accompanies this distribution. The full text of the license may be found at\r
8; http://opensource.org/licenses/bsd-license.php.\r
9;\r
10; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12;;\r
13\r
14 SECTION .text\r
15\r
16global ASM_PFX(FspInfoHeaderRelativeOff)\r
90fadfc0
YS
17ASM_PFX(FspInfoHeaderRelativeOff):\r
18 DD 0x12345678 ; This value must be patched by the build script\r
cf1d4549
JY
19\r
20global ASM_PFX(AsmGetFspBaseAddress)\r
21ASM_PFX(AsmGetFspBaseAddress):\r
8265373e 22 call ASM_PFX(AsmGetFspInfoHeader)\r
cf1d4549
JY
23 add eax, 0x1C\r
24 mov eax, dword [eax]\r
25 ret\r
26\r
27global ASM_PFX(AsmGetFspInfoHeader)\r
28ASM_PFX(AsmGetFspInfoHeader):\r
8265373e
YS
29 call ASM_PFX(NextInstruction)\r
30ASM_PFX(NextInstruction):\r
31 pop eax\r
32 sub eax, ASM_PFX(NextInstruction)\r
33 add eax, ASM_PFX(AsmGetFspInfoHeader)\r
08354c34 34 sub eax, dword [eax - ASM_PFX(AsmGetFspInfoHeader) + ASM_PFX(FspInfoHeaderRelativeOff)]\r
cf1d4549 35 ret\r
90fadfc0
YS
36\r
37global ASM_PFX(AsmGetFspInfoHeaderNoStack)\r
38ASM_PFX(AsmGetFspInfoHeaderNoStack):\r
39 mov eax, ASM_PFX(AsmGetFspInfoHeader)\r
40 sub eax, dword [ASM_PFX(FspInfoHeaderRelativeOff)]\r
41 jmp edi\r