OvmfPkg/Sec: Fix 64bit SEC build failure
[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
46c6b956
RN
48 mov rax, (FixedPcdGet32 (PcdInitValueInTempStack) << 32) | FixedPcdGet32 (PcdInitValueInTempStack)\r
49 ; qword to store\r
2278b8a8
LE
50 mov rdi, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) ; base address,\r
51 ; relative to\r
52 ; ES\r
53 mov rcx, FixedPcdGet32 (PcdOvmfSecPeiTempRamSize) / 8 ; qword count\r
54 cld ; store from base\r
55 ; up\r
56 rep stosq\r
57\r
49ba9447 58 ;\r
7cb6b0e0 59 ; Load temporary RAM stack based on PCDs\r
49ba9447 60 ;\r
d8cfdb5f 61 %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
7cb6b0e0
JJ
62 FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))\r
63 mov rsp, SEC_TOP_OF_STACK\r
49ba9447 64 nop\r
65\r
66 ;\r
67 ; Setup parameters and call SecCoreStartupWithStack\r
68 ; rcx: BootFirmwareVolumePtr\r
0913fadc 69 ; rdx: TopOfCurrentStack\r
49ba9447 70 ;\r
71 mov rcx, rbp\r
0913fadc 72 mov rdx, rsp\r
d8cfdb5f
JJ
73 sub rsp, 0x20\r
74 call ASM_PFX(SecCoreStartupWithStack)\r
49ba9447 75\r