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