1 /** @file
2 IA-32 processor specific functions to enable SMM profile.
3
4 Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "PiSmmCpuDxeSmm.h"
16 #include "SmmProfileInternal.h"
17
18 /**
19 Create SMM page table for S3 path.
20
21 **/
22 VOID
InitSmmS3Cr3(VOID)23 InitSmmS3Cr3 (
24 VOID
25 )
26 {
27 mSmmS3ResumeState->SmmS3Cr3 = Gen4GPageTable (0, TRUE);
28
29 return ;
30 }
31
32 /**
33 Allocate pages for creating 4KB-page based on 2MB-page when page fault happens.
34 32-bit firmware does not need it.
35
36 **/
37 VOID
InitPagesForPFHandler(VOID)38 InitPagesForPFHandler (
39 VOID
40 )
41 {
42 }
43
44 /**
45 Update page table to map the memory correctly in order to make the instruction
46 which caused page fault execute successfully. And it also save the original page
47 table to be restored in single-step exception. 32-bit firmware does not need it.
48
49 @param PageTable PageTable Address.
50 @param PFAddress The memory address which caused page fault exception.
51 @param CpuIndex The index of the processor.
52 @param ErrorCode The Error code of exception.
53 @param IsValidPFAddress The flag indicates if SMM profile data need be added.
54
55 **/
56 VOID
RestorePageTableAbove4G(UINT64 * PageTable,UINT64 PFAddress,UINTN CpuIndex,UINTN ErrorCode,BOOLEAN * IsValidPFAddress)57 RestorePageTableAbove4G (
58 UINT64 *PageTable,
59 UINT64 PFAddress,
60 UINTN CpuIndex,
61 UINTN ErrorCode,
62 BOOLEAN *IsValidPFAddress
63 )
64 {
65 }
66
67 /**
68 Clear TF in FLAGS.
69
70 @param SystemContext A pointer to the processor context when
71 the interrupt occurred on the processor.
72
73 **/
74 VOID
ClearTrapFlag(IN OUT EFI_SYSTEM_CONTEXT SystemContext)75 ClearTrapFlag (
76 IN OUT EFI_SYSTEM_CONTEXT SystemContext
77 )
78 {
79 SystemContext.SystemContextIa32->Eflags &= (UINTN) ~BIT8;
80 }
81