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