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