]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/ResetVector/ResetVector.nasmb
OvmfPkg: Create a GHCB page for use during Sec phase
[mirror_edk2.git] / OvmfPkg / ResetVector / ResetVector.nasmb
1 ;------------------------------------------------------------------------------
2 ; @file
3 ; This file includes all other code files to assemble the reset vector code
4 ;
5 ; Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
6 ; SPDX-License-Identifier: BSD-2-Clause-Patent
7 ;
8 ;------------------------------------------------------------------------------
9
10 ;
11 ; If neither ARCH_IA32 nor ARCH_X64 are defined, then try to include
12 ; Base.h to use the C pre-processor to determine the architecture.
13 ;
14 %ifndef ARCH_IA32
15 %ifndef ARCH_X64
16 #include <Base.h>
17 #if defined (MDE_CPU_IA32)
18 %define ARCH_IA32
19 #elif defined (MDE_CPU_X64)
20 %define ARCH_X64
21 #endif
22 %endif
23 %endif
24
25 %ifdef ARCH_IA32
26 %ifdef ARCH_X64
27 %error "Only one of ARCH_IA32 or ARCH_X64 can be defined."
28 %endif
29 %elifdef ARCH_X64
30 %else
31 %error "Either ARCH_IA32 or ARCH_X64 must be defined."
32 %endif
33
34 %include "CommonMacros.inc"
35
36 %include "PostCodes.inc"
37
38 %ifdef DEBUG_PORT80
39 %include "Port80Debug.asm"
40 %elifdef DEBUG_SERIAL
41 %include "SerialDebug.asm"
42 %else
43 %include "DebugDisabled.asm"
44 %endif
45
46 %include "Ia32/SearchForBfvBase.asm"
47 %include "Ia32/SearchForSecEntry.asm"
48
49 %ifdef ARCH_X64
50 #include <AutoGen.h>
51
52 %if (FixedPcdGet32 (PcdOvmfSecPageTablesSize) != 0x6000)
53 %error "This implementation inherently depends on PcdOvmfSecPageTablesSize"
54 %endif
55
56 %if (FixedPcdGet32 (PcdOvmfSecGhcbPageTableSize) != 0x1000)
57 %error "This implementation inherently depends on PcdOvmfSecGhcbPageTableSize"
58 %endif
59
60 %if (FixedPcdGet32 (PcdOvmfSecGhcbSize) != 0x2000)
61 %error "This implementation inherently depends on PcdOvmfSecGhcbSize"
62 %endif
63
64 %if ((FixedPcdGet32 (PcdOvmfSecGhcbBase) >> 21) != \
65 ((FixedPcdGet32 (PcdOvmfSecGhcbBase) + FixedPcdGet32 (PcdOvmfSecGhcbSize) - 1) >> 21))
66 %error "This implementation inherently depends on PcdOvmfSecGhcbBase not straddling a 2MB boundary"
67 %endif
68
69 %define PT_ADDR(Offset) (FixedPcdGet32 (PcdOvmfSecPageTablesBase) + (Offset))
70 %include "Ia32/Flat32ToFlat64.asm"
71
72 %define GHCB_PT_ADDR (FixedPcdGet32 (PcdOvmfSecGhcbPageTableBase))
73 %define GHCB_BASE (FixedPcdGet32 (PcdOvmfSecGhcbBase))
74 %define GHCB_SIZE (FixedPcdGet32 (PcdOvmfSecGhcbSize))
75 %include "Ia32/PageTables64.asm"
76 %endif
77
78 %include "Ia16/Real16ToFlat32.asm"
79 %include "Ia16/Init16.asm"
80
81 %include "Main.asm"
82
83 %include "Ia16/ResetVectorVtf0.asm"
84