]>
Commit | Line | Data |
---|---|---|
7947da3c MK |
1 | /** @file\r |
2 | IA-32 processor specific header file to enable SMM profile.\r | |
3 | \r | |
4 | Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>\r | |
0acd8697 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
7947da3c MK |
6 | \r |
7 | **/\r | |
8 | \r | |
9 | #ifndef _SMM_PROFILE_ARCH_H_\r | |
10 | #define _SMM_PROFILE_ARCH_H_\r | |
11 | \r | |
12 | #pragma pack (1)\r | |
13 | \r | |
14 | typedef struct _MSR_DS_AREA_STRUCT {\r | |
053e878b MK |
15 | UINT32 BTSBufferBase;\r |
16 | UINT32 BTSIndex;\r | |
17 | UINT32 BTSAbsoluteMaximum;\r | |
18 | UINT32 BTSInterruptThreshold;\r | |
19 | UINT32 PEBSBufferBase;\r | |
20 | UINT32 PEBSIndex;\r | |
21 | UINT32 PEBSAbsoluteMaximum;\r | |
22 | UINT32 PEBSInterruptThreshold;\r | |
23 | UINT32 PEBSCounterReset[4];\r | |
24 | UINT32 Reserved;\r | |
7947da3c MK |
25 | } MSR_DS_AREA_STRUCT;\r |
26 | \r | |
27 | typedef struct _BRANCH_TRACE_RECORD {\r | |
053e878b MK |
28 | UINT32 LastBranchFrom;\r |
29 | UINT32 LastBranchTo;\r | |
30 | UINT32 Rsvd0 : 4;\r | |
31 | UINT32 BranchPredicted : 1;\r | |
32 | UINT32 Rsvd1 : 27;\r | |
7947da3c MK |
33 | } BRANCH_TRACE_RECORD;\r |
34 | \r | |
35 | typedef struct _PEBS_RECORD {\r | |
053e878b MK |
36 | UINT32 Eflags;\r |
37 | UINT32 LinearIP;\r | |
38 | UINT32 Eax;\r | |
39 | UINT32 Ebx;\r | |
40 | UINT32 Ecx;\r | |
41 | UINT32 Edx;\r | |
42 | UINT32 Esi;\r | |
43 | UINT32 Edi;\r | |
44 | UINT32 Ebp;\r | |
45 | UINT32 Esp;\r | |
7947da3c MK |
46 | } PEBS_RECORD;\r |
47 | \r | |
48 | #pragma pack ()\r | |
49 | \r | |
053e878b | 50 | #define PHYSICAL_ADDRESS_MASK ((1ull << 32) - SIZE_4KB)\r |
7947da3c MK |
51 | \r |
52 | /**\r | |
53 | Update page table to map the memory correctly in order to make the instruction\r | |
54 | which caused page fault execute successfully. And it also save the original page\r | |
55 | table to be restored in single-step exception. 32-bit firmware does not need it.\r | |
56 | \r | |
57 | @param PageTable PageTable Address.\r | |
58 | @param PFAddress The memory address which caused page fault exception.\r | |
59 | @param CpuIndex The index of the processor.\r | |
60 | @param ErrorCode The Error code of exception.\r | |
61 | @param IsValidPFAddress The flag indicates if SMM profile data need be added.\r | |
62 | \r | |
63 | **/\r | |
64 | VOID\r | |
65 | RestorePageTableAbove4G (\r | |
053e878b MK |
66 | UINT64 *PageTable,\r |
67 | UINT64 PFAddress,\r | |
68 | UINTN CpuIndex,\r | |
69 | UINTN ErrorCode,\r | |
70 | BOOLEAN *IsValidPFAddress\r | |
7947da3c MK |
71 | );\r |
72 | \r | |
73 | /**\r | |
74 | Create SMM page table for S3 path.\r | |
75 | \r | |
76 | **/\r | |
77 | VOID\r | |
78 | InitSmmS3Cr3 (\r | |
79 | VOID\r | |
80 | );\r | |
81 | \r | |
82 | /**\r | |
83 | Allocate pages for creating 4KB-page based on 2MB-page when page fault happens.\r | |
84 | \r | |
85 | **/\r | |
86 | VOID\r | |
87 | InitPagesForPFHandler (\r | |
88 | VOID\r | |
89 | );\r | |
90 | \r | |
91 | #endif // _SMM_PROFILE_ARCH_H_\r |