]>
Commit | Line | Data |
---|---|---|
427e3573 MK |
1 | /** @file\r |
2 | X64 processor specific header file to enable SMM profile.\r | |
3 | \r | |
4 | Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _SMM_PROFILE_ARCH_H_\r | |
16 | #define _SMM_PROFILE_ARCH_H_\r | |
17 | \r | |
18 | #pragma pack (1)\r | |
19 | \r | |
20 | typedef struct _MSR_DS_AREA_STRUCT {\r | |
21 | UINT64 BTSBufferBase;\r | |
22 | UINT64 BTSIndex;\r | |
23 | UINT64 BTSAbsoluteMaximum;\r | |
24 | UINT64 BTSInterruptThreshold;\r | |
25 | UINT64 PEBSBufferBase;\r | |
26 | UINT64 PEBSIndex;\r | |
27 | UINT64 PEBSAbsoluteMaximum;\r | |
28 | UINT64 PEBSInterruptThreshold;\r | |
29 | UINT64 PEBSCounterReset[2];\r | |
30 | UINT64 Reserved;\r | |
31 | } MSR_DS_AREA_STRUCT;\r | |
32 | \r | |
33 | typedef struct _BRANCH_TRACE_RECORD {\r | |
34 | UINT64 LastBranchFrom;\r | |
35 | UINT64 LastBranchTo;\r | |
36 | UINT64 Rsvd0 : 4;\r | |
37 | UINT64 BranchPredicted : 1;\r | |
38 | UINT64 Rsvd1 : 59;\r | |
39 | } BRANCH_TRACE_RECORD;\r | |
40 | \r | |
41 | typedef struct _PEBS_RECORD {\r | |
42 | UINT64 Rflags;\r | |
43 | UINT64 LinearIP;\r | |
44 | UINT64 Rax;\r | |
45 | UINT64 Rbx;\r | |
46 | UINT64 Rcx;\r | |
47 | UINT64 Rdx;\r | |
48 | UINT64 Rsi;\r | |
49 | UINT64 Rdi;\r | |
50 | UINT64 Rbp;\r | |
51 | UINT64 Rsp;\r | |
52 | UINT64 R8;\r | |
53 | UINT64 R9;\r | |
54 | UINT64 R10;\r | |
55 | UINT64 R11;\r | |
56 | UINT64 R12;\r | |
57 | UINT64 R13;\r | |
58 | UINT64 R14;\r | |
59 | UINT64 R15;\r | |
60 | } PEBS_RECORD;\r | |
61 | \r | |
62 | #pragma pack ()\r | |
63 | \r | |
64 | #define PHYSICAL_ADDRESS_MASK ((1ull << 52) - SIZE_4KB)\r | |
65 | \r | |
66 | /**\r | |
67 | Update page table to map the memory correctly in order to make the instruction\r | |
68 | which caused page fault execute successfully. And it also save the original page\r | |
69 | table to be restored in single-step exception.\r | |
70 | \r | |
71 | @param PageTable PageTable Address.\r | |
72 | @param PFAddress The memory address which caused page fault exception.\r | |
73 | @param CpuIndex The index of the processor.\r | |
74 | @param ErrorCode The Error code of exception.\r | |
75 | @param IsValidPFAddress The flag indicates if SMM profile data need be added.\r | |
76 | \r | |
77 | **/\r | |
78 | VOID\r | |
79 | RestorePageTableAbove4G (\r | |
80 | UINT64 *PageTable,\r | |
81 | UINT64 PFAddress,\r | |
82 | UINTN CpuIndex,\r | |
83 | UINTN ErrorCode,\r | |
84 | BOOLEAN *IsValidPFAddress\r | |
85 | );\r | |
86 | \r | |
87 | /**\r | |
88 | Create SMM page table for S3 path.\r | |
89 | \r | |
90 | **/\r | |
91 | VOID\r | |
92 | InitSmmS3Cr3 (\r | |
93 | VOID\r | |
94 | );\r | |
95 | \r | |
96 | /**\r | |
97 | Allocate pages for creating 4KB-page based on 2MB-page when page fault happens.\r | |
98 | \r | |
99 | **/\r | |
100 | VOID\r | |
101 | InitPagesForPFHandler (\r | |
102 | VOID\r | |
103 | );\r | |
104 | \r | |
105 | #endif // _SMM_PROFILE_ARCH_H_\r |