1 | /** @file
|
---|
2 | IA-32 processor specific functions to enable SMM profile.
|
---|
3 |
|
---|
4 | Copyright (c) 2012 - 2024, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #include "PiSmmCpuCommon.h"
|
---|
10 | #include "SmmProfileInternal.h"
|
---|
11 |
|
---|
12 | /**
|
---|
13 | Create SMM page table for S3 path.
|
---|
14 |
|
---|
15 | @param[out] Cr3 The base address of the page tables.
|
---|
16 |
|
---|
17 | **/
|
---|
18 | VOID
|
---|
19 | InitSmmS3Cr3 (
|
---|
20 | OUT UINTN *Cr3
|
---|
21 | )
|
---|
22 | {
|
---|
23 | ASSERT (Cr3 != NULL);
|
---|
24 |
|
---|
25 | *Cr3 = GenSmmPageTable (PagingPae, mPhysicalAddressBits);
|
---|
26 |
|
---|
27 | return;
|
---|
28 | }
|
---|
29 |
|
---|
30 | /**
|
---|
31 | Allocate pages for creating 4KB-page based on 2MB-page when page fault happens.
|
---|
32 | 32-bit firmware does not need it.
|
---|
33 |
|
---|
34 | **/
|
---|
35 | VOID
|
---|
36 | InitPagesForPFHandler (
|
---|
37 | VOID
|
---|
38 | )
|
---|
39 | {
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | Update page table to map the memory correctly in order to make the instruction
|
---|
44 | which caused page fault execute successfully. And it also save the original page
|
---|
45 | table to be restored in single-step exception. 32-bit firmware does not need it.
|
---|
46 |
|
---|
47 | @param PageTable PageTable Address.
|
---|
48 | @param PFAddress The memory address which caused page fault exception.
|
---|
49 | @param CpuIndex The index of the processor.
|
---|
50 | @param ErrorCode The Error code of exception.
|
---|
51 | @param IsValidPFAddress The flag indicates if SMM profile data need be added.
|
---|
52 |
|
---|
53 | **/
|
---|
54 | VOID
|
---|
55 | RestorePageTableAbove4G (
|
---|
56 | UINT64 *PageTable,
|
---|
57 | UINT64 PFAddress,
|
---|
58 | UINTN CpuIndex,
|
---|
59 | UINTN ErrorCode,
|
---|
60 | BOOLEAN *IsValidPFAddress
|
---|
61 | )
|
---|
62 | {
|
---|
63 | }
|
---|
64 |
|
---|
65 | /**
|
---|
66 | Clear TF in FLAGS.
|
---|
67 |
|
---|
68 | @param SystemContext A pointer to the processor context when
|
---|
69 | the interrupt occurred on the processor.
|
---|
70 |
|
---|
71 | **/
|
---|
72 | VOID
|
---|
73 | ClearTrapFlag (
|
---|
74 | IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
---|
75 | )
|
---|
76 | {
|
---|
77 | SystemContext.SystemContextIa32->Eflags &= (UINTN) ~BIT8;
|
---|
78 | }
|
---|
79 |
|
---|
80 | /**
|
---|
81 | Create new entry in page table for page fault address in SmmProfilePFHandler.
|
---|
82 |
|
---|
83 | **/
|
---|
84 | VOID
|
---|
85 | SmmProfileMapPFAddress (
|
---|
86 | VOID
|
---|
87 | )
|
---|
88 | {
|
---|
89 | CpuDeadLoop ();
|
---|
90 | }
|
---|