]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Sec/Ia32/SecEntry.nasm
OvmfPkg/Sec/Ia32: seed the temporary RAM with PcdInitValueInTempStack
[mirror_edk2.git] / OvmfPkg / Sec / Ia32 / 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
ba29ed09 20 SECTION .text\r
49ba9447 21\r
ba29ed09 22extern ASM_PFX(SecCoreStartupWithStack)\r
49ba9447 23\r
24;\r
0913fadc 25; SecCore Entry Point\r
49ba9447 26;\r
0913fadc 27; Processor is in flat protected mode\r
49ba9447 28;\r
0913fadc 29; @param[in] EAX Initial value of the EAX register (BIST: Built-in Self Test)\r
30; @param[in] DI 'BP': boot-strap processor, or 'AP': application processor\r
31; @param[in] EBP Pointer to the start of the Boot Firmware Volume\r
9d9350a5
LE
32; @param[in] DS Selector allowing flat access to all addresses\r
33; @param[in] ES Selector allowing flat access to all addresses\r
34; @param[in] FS Selector allowing flat access to all addresses\r
35; @param[in] GS Selector allowing flat access to all addresses\r
36; @param[in] SS Selector allowing flat access to all addresses\r
49ba9447 37;\r
0913fadc 38; @return None This routine does not return\r
49ba9447 39;\r
ba29ed09
JJ
40global ASM_PFX(_ModuleEntryPoint)\r
41ASM_PFX(_ModuleEntryPoint):\r
49ba9447 42\r
9d9350a5
LE
43 ;\r
44 ; Fill the temporary RAM with the initial stack value.\r
45 ; The loop below will seed the heap as well, but that's harmless.\r
46 ;\r
47 mov eax, FixedPcdGet32 (PcdInitValueInTempStack) ; dword to store\r
48 mov edi, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) ; base address,\r
49 ; relative to\r
50 ; ES\r
51 mov ecx, FixedPcdGet32 (PcdOvmfSecPeiTempRamSize) / 4 ; dword count\r
52 cld ; store from base\r
53 ; up\r
54 rep stosd\r
55\r
49ba9447 56 ;\r
7cb6b0e0 57 ; Load temporary RAM stack based on PCDs\r
49ba9447 58 ;\r
ba29ed09 59 %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
7cb6b0e0
JJ
60 FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))\r
61 mov eax, SEC_TOP_OF_STACK\r
49ba9447 62 mov esp, eax\r
63 nop\r
64\r
65 ;\r
7cb6b0e0
JJ
66 ; Setup parameters and call SecCoreStartupWithStack\r
67 ; [esp] return address for call\r
68 ; [esp+4] BootFirmwareVolumePtr\r
69 ; [esp+8] TopOfCurrentStack\r
49ba9447 70 ;\r
71 push eax\r
49ba9447 72 push ebp\r
ba29ed09 73 call ASM_PFX(SecCoreStartupWithStack)\r
49ba9447 74\r