]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / SmmProfile.h
CommitLineData
529a5a86
MK
1/** @file\r
2SMM profile header file.\r
3\r
3eb69b08 4Copyright (c) 2012 - 2019, Intel Corporation. All rights reserved.<BR>\r
0acd8697 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
529a5a86
MK
6\r
7**/\r
8\r
9#ifndef _SMM_PROFILE_H_\r
10#define _SMM_PROFILE_H_\r
11\r
12#include "SmmProfileInternal.h"\r
13\r
529a5a86
MK
14//\r
15// External functions\r
16//\r
17\r
18/**\r
19 Initialize processor environment for SMM profile.\r
20\r
21 @param CpuIndex The index of the processor.\r
22\r
23**/\r
24VOID\r
25ActivateSmmProfile (\r
053e878b 26 IN UINTN CpuIndex\r
529a5a86
MK
27 );\r
28\r
29/**\r
30 Initialize SMM profile in SMM CPU entry point.\r
31\r
32 @param[in] Cr3 The base address of the page tables to use in SMM.\r
33\r
34**/\r
35VOID\r
36InitSmmProfile (\r
37 UINT32 Cr3\r
38 );\r
39\r
40/**\r
41 Increase SMI number in each SMI entry.\r
42\r
43**/\r
44VOID\r
45SmmProfileRecordSmiNum (\r
46 VOID\r
47 );\r
48\r
49/**\r
50 The Page fault handler to save SMM profile data.\r
51\r
52 @param Rip The RIP when exception happens.\r
53 @param ErrorCode The Error code of exception.\r
54\r
55**/\r
56VOID\r
57SmmProfilePFHandler (\r
053e878b
MK
58 UINTN Rip,\r
59 UINTN ErrorCode\r
529a5a86
MK
60 );\r
61\r
62/**\r
63 Updates page table to make some memory ranges (like system memory) absent\r
64 and make some memory ranges (like MMIO) present and execute disable. It also\r
65 update 2MB-page to 4KB-page for some memory ranges.\r
66\r
67**/\r
68VOID\r
69SmmProfileStart (\r
70 VOID\r
71 );\r
72\r
73/**\r
74 Page fault IDT handler for SMM Profile.\r
75\r
76**/\r
77VOID\r
78EFIAPI\r
79PageFaultIdtHandlerSmmProfile (\r
80 VOID\r
81 );\r
82\r
529a5a86 83/**\r
3eb69b08 84 Check if feature is supported by a processor.\r
529a5a86
MK
85\r
86**/\r
87VOID\r
88CheckFeatureSupported (\r
51773d49 89 VOID\r
529a5a86
MK
90 );\r
91\r
529a5a86
MK
92/**\r
93 Update page table according to protected memory ranges and the 4KB-page mapped memory ranges.\r
94\r
95**/\r
96VOID\r
97InitPaging (\r
98 VOID\r
99 );\r
100\r
7fa1376c
JY
101/**\r
102 Get CPU Index from APIC ID.\r
103\r
104**/\r
105UINTN\r
106GetCpuIndex (\r
107 VOID\r
108 );\r
109\r
09afd9a4
JW
110/**\r
111 Handler for Page Fault triggered by Guard page.\r
112\r
113 @param ErrorCode The Error code of exception.\r
114\r
115**/\r
116VOID\r
117GuardPagePFHandler (\r
053e878b 118 UINTN ErrorCode\r
09afd9a4
JW
119 );\r
120\r
717fb604
JY
121//\r
122// The flag indicates if execute-disable is supported by processor.\r
123//\r
053e878b 124extern BOOLEAN mXdSupported;\r
717fb604
JY
125//\r
126// The flag indicates if execute-disable is enabled on processor.\r
127//\r
053e878b 128extern BOOLEAN mXdEnabled;\r
09afd9a4
JW
129//\r
130// The flag indicates if #DB will be setup in #PF handler.\r
131//\r
053e878b 132extern BOOLEAN mSetupDebugTrap;\r
529a5a86
MK
133\r
134#endif // _SMM_PROFILE_H_\r