summaryrefslogtreecommitdiffstats
path: root/IntelFsp2Pkg/FspSecCore/X64/FspHelper.nasm
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFsp2Pkg/FspSecCore/X64/FspHelper.nasm')
-rw-r--r--IntelFsp2Pkg/FspSecCore/X64/FspHelper.nasm34
1 files changed, 34 insertions, 0 deletions
diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspHelper.nasm b/IntelFsp2Pkg/FspSecCore/X64/FspHelper.nasm
new file mode 100644
index 0000000000..122fa1d174
--- /dev/null
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspHelper.nasm
@@ -0,0 +1,34 @@
+;; @file
+; Provide FSP helper function.
+;
+; Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;;
+ DEFAULT REL
+ SECTION .text
+
+global ASM_PFX(AsmGetFspBaseAddress)
+ASM_PFX(AsmGetFspBaseAddress):
+ call ASM_PFX(AsmGetFspInfoHeader)
+ add rax, 0x1C
+ mov eax, [rax]
+ ret
+
+global ASM_PFX(AsmGetFspInfoHeader)
+ASM_PFX(AsmGetFspInfoHeader):
+ lea rax, [ASM_PFX(AsmGetFspInfoHeader)]
+ DB 0x48, 0x2d ; sub rax, 0x????????
+global ASM_PFX(FspInfoHeaderRelativeOff)
+ASM_PFX(FspInfoHeaderRelativeOff):
+ DD 0x12345678 ; This value must be patched by the build script
+ and rax, 0xffffffff
+ ret
+
+global ASM_PFX(AsmGetFspInfoHeaderNoStack)
+ASM_PFX(AsmGetFspInfoHeaderNoStack):
+ lea rax, [ASM_PFX(AsmGetFspInfoHeader)]
+ lea rcx, [ASM_PFX(FspInfoHeaderRelativeOff)]
+ mov ecx, [rcx]
+ sub rax, rcx
+ and rax, 0xffffffff
+ jmp rdi