]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.h
UefiCpuPkg: Replace BSD License with BSD+Patent License
[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
26 IN UINTN CpuIndex\r
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
58 UINTN Rip,\r
59 UINTN ErrorCode\r
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
83\r
84/**\r
3eb69b08 85 Check if feature is supported by a processor.\r
529a5a86
MK
86\r
87**/\r
88VOID\r
89CheckFeatureSupported (\r
51773d49 90 VOID\r
529a5a86
MK
91 );\r
92\r
529a5a86
MK
93/**\r
94 Update page table according to protected memory ranges and the 4KB-page mapped memory ranges.\r
95\r
96**/\r
97VOID\r
98InitPaging (\r
99 VOID\r
100 );\r
101\r
7fa1376c
JY
102/**\r
103 Get CPU Index from APIC ID.\r
104\r
105**/\r
106UINTN\r
107GetCpuIndex (\r
108 VOID\r
109 );\r
110\r
09afd9a4
JW
111/**\r
112 Handler for Page Fault triggered by Guard page.\r
113\r
114 @param ErrorCode The Error code of exception.\r
115\r
116**/\r
117VOID\r
118GuardPagePFHandler (\r
119 UINTN ErrorCode\r
120 );\r
121\r
717fb604
JY
122//\r
123// The flag indicates if execute-disable is supported by processor.\r
124//\r
529a5a86 125extern BOOLEAN mXdSupported;\r
717fb604
JY
126//\r
127// The flag indicates if execute-disable is enabled on processor.\r
128//\r
529a5a86 129extern BOOLEAN mXdEnabled;\r
09afd9a4
JW
130//\r
131// The flag indicates if #DB will be setup in #PF handler.\r
132//\r
133extern BOOLEAN mSetupDebugTrap;\r
529a5a86
MK
134\r
135#endif // _SMM_PROFILE_H_\r