]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - OvmfPkg/Sec/X64/SecEntry.nasm
ShellPkg/DynamicCommand: Fix bug that cannot start in boot
[mirror_edk2.git] / OvmfPkg / Sec / X64 / SecEntry.nasm
... / ...
CommitLineData
1;------------------------------------------------------------------------------\r
2;*\r
3;* Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
4;* This program and the accompanying materials\r
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
18#include <Base.h>\r
19\r
20DEFAULT REL\r
21SECTION .text\r
22\r
23extern ASM_PFX(SecCoreStartupWithStack)\r
24\r
25;\r
26; SecCore Entry Point\r
27;\r
28; Processor is in flat protected mode\r
29;\r
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
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
38;\r
39; @return None This routine does not return\r
40;\r
41global ASM_PFX(_ModuleEntryPoint)\r
42ASM_PFX(_ModuleEntryPoint):\r
43\r
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
60 ;\r
61 ; Load temporary RAM stack based on PCDs\r
62 ;\r
63 %define SEC_TOP_OF_STACK (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) + \\r
64 FixedPcdGet32 (PcdOvmfSecPeiTempRamSize))\r
65 mov rsp, SEC_TOP_OF_STACK\r
66 nop\r
67\r
68 ;\r
69 ; Setup parameters and call SecCoreStartupWithStack\r
70 ; rcx: BootFirmwareVolumePtr\r
71 ; rdx: TopOfCurrentStack\r
72 ;\r
73 mov rcx, rbp\r
74 mov rdx, rsp\r
75 sub rsp, 0x20\r
76 call ASM_PFX(SecCoreStartupWithStack)\r
77\r