]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Sec/X64/SecEntry.nasm
OvmfPkg/Sec/X64: seed the temporary RAM with PcdInitValueInTempStack
[mirror_edk2.git] / OvmfPkg / Sec / X64 / SecEntry.nasm
CommitLineData
49ba9447 1;------------------------------------------------------------------------------\r
2;*\r
7cb6b0e0 3;* Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
56d7640a 4;* This program and the accompanying materials\r
49ba9447 5;* are licensed and made available under the terms and conditions of the BSD License\r
6;* which accompanies this distribution. The full text of the license may be found at\r
7;* http://opensource.org/licenses/bsd-license.php\r
8;*\r
9;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11;*\r
12;* CpuAsm.asm\r
13;*\r
14;* Abstract:\r
15;*\r
16;------------------------------------------------------------------------------\r
17\r
42a83e80 18#include <Base.h>\r
49ba9447 19\r
d8cfdb5f
JJ
20DEFAULT REL\r
21SECTION .text\r
49ba9447 22\r
d8cfdb5f 23extern ASM_PFX(SecCoreStartupWithStack)\r
49ba9447 24\r
25;\r
0913fadc 26; SecCore Entry Point\r
49ba9447 27;\r
0913fadc 28; Processor is in flat protected mode\r
49ba9447 29;\r
0913fadc 30; @param[in] RAX Initial value of the EAX register (BIST: Built-in Self Test)\r
31; @param[in] DI 'BP': boot-strap processor, or 'AP': application processor\r
32; @param[in] RBP Pointer to the start of the Boot Firmware Volume\r
2278b8a8
LE
33; @param[in] DS Selector allowing flat access to all addresses\r
34; @param[in] ES Selector allowing flat access to all addresses\r
35; @param[in] FS Selector allowing flat access to all addresses\r
36; @param[in] GS Selector allowing flat access to all addresses\r
37; @param[in] SS Selector allowing flat access to all addresses\r
49ba9447 38;\r
0913fadc 39; @return None This routine does not return\r
49ba9447 40;\r
d8cfdb5f
JJ
41global ASM_PFX(_ModuleEntryPoint)\r
42ASM_PFX(_ModuleEntryPoint):\r
49ba9447 43\r
2278b8a8
LE
44 ;\r
45 ; Fill the temporary RAM with the initial stack value.\r
46 ; The loop below will seed the heap as well, but that's harmless.\r
47 ;\r
48 mov rax, (FixedPcdGet32 ( \\r
49 PcdInitValueInTempStack \\r
50 ) << 32) | \\r
51 FixedPcdGet32 (PcdInitValueInTempStack) ; qword to store\r
52 mov rdi, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) ; base address,\r
53 ; relative to\r
54 ; ES\r
55 mov rcx, FixedPcdGet32 (PcdOvmfSecPeiTempRamSize) / 8 ; qword count\r
56 cld ; store from base\r
57 ; up\r
58 rep stosq\r
59\r
49ba9447 60 ;\r
7cb6b0e0 61 ; Load temporary RAM stack based on PCDs\r
49ba9447 62 ;\r
d8cfdb5f 63 %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
7cb6b0e0
JJ
64 FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))\r
65 mov rsp, SEC_TOP_OF_STACK\r
49ba9447 66 nop\r
67\r
68 ;\r
69 ; Setup parameters and call SecCoreStartupWithStack\r
70 ; rcx: BootFirmwareVolumePtr\r
0913fadc 71 ; rdx: TopOfCurrentStack\r
49ba9447 72 ;\r
73 mov rcx, rbp\r
0913fadc 74 mov rdx, rsp\r
d8cfdb5f
JJ
75 sub rsp, 0x20\r
76 call ASM_PFX(SecCoreStartupWithStack)\r
49ba9447 77\r