]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Sec/X64/SecEntry.nasm
IntelFsp2Pkg/SplitFspBin.py: Support rebasing 1.x binary.
[mirror_edk2.git] / OvmfPkg / Sec / X64 / SecEntry.nasm
1 ;------------------------------------------------------------------------------
2 ;*
3 ;* Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
4 ;* SPDX-License-Identifier: BSD-2-Clause-Patent
5 ;*
6 ;* CpuAsm.asm
7 ;*
8 ;* Abstract:
9 ;*
10 ;------------------------------------------------------------------------------
11
12 #include <Base.h>
13
14 DEFAULT REL
15 SECTION .text
16
17 extern ASM_PFX(SecCoreStartupWithStack)
18
19 ;
20 ; SecCore Entry Point
21 ;
22 ; Processor is in flat protected mode
23 ;
24 ; @param[in] RAX Initial value of the EAX register (BIST: Built-in Self Test)
25 ; @param[in] DI 'BP': boot-strap processor, or 'AP': application processor
26 ; @param[in] RBP Pointer to the start of the Boot Firmware Volume
27 ; @param[in] DS Selector allowing flat access to all addresses
28 ; @param[in] ES Selector allowing flat access to all addresses
29 ; @param[in] FS Selector allowing flat access to all addresses
30 ; @param[in] GS Selector allowing flat access to all addresses
31 ; @param[in] SS Selector allowing flat access to all addresses
32 ;
33 ; @return None This routine does not return
34 ;
35 global ASM_PFX(_ModuleEntryPoint)
36 ASM_PFX(_ModuleEntryPoint):
37
38 ;
39 ; Fill the temporary RAM with the initial stack value.
40 ; The loop below will seed the heap as well, but that's harmless.
41 ;
42 mov rax, (FixedPcdGet32 (PcdInitValueInTempStack) << 32) | FixedPcdGet32 (PcdInitValueInTempStack)
43 ; qword to store
44 mov rdi, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) ; base address,
45 ; relative to
46 ; ES
47 mov rcx, FixedPcdGet32 (PcdOvmfSecPeiTempRamSize) / 8 ; qword count
48 cld ; store from base
49 ; up
50 rep stosq
51
52 ;
53 ; Load temporary RAM stack based on PCDs
54 ;
55 %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \
56 FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))
57 mov rsp, SEC_TOP_OF_STACK
58 nop
59
60 ;
61 ; Setup parameters and call SecCoreStartupWithStack
62 ; rcx: BootFirmwareVolumePtr
63 ; rdx: TopOfCurrentStack
64 ;
65 mov rcx, rbp
66 mov rdx, rsp
67 sub rsp, 0x20
68 call ASM_PFX(SecCoreStartupWithStack)
69