So that we can use write-protection for code later. This is REPOST. It includes the bug fix from "Paolo Bonzini" <pbonzini@redhat.com>: Title: fix generation of 32-bit PAE page tables "Bits 1 and 2 are reserved in 32-bit PAE Page Directory Pointer Table Entries (PDPTEs); see Table 4-8 in the SDM. With VMX extended page tables, the processor notices and fails the VM entry as soon as CR0.PG is set to 1." And thanks "Laszlo Ersek" <lersek@redhat.com> to validate the fix. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com> Signed-off-by: "Paolo Bonzini" <pbonzini@redhat.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Cc: "Fan, Jeff" <jeff.fan@intel.com> Cc: "Kinney, Michael D" <michael.d.kinney@intel.com> Cc: "Laszlo Ersek" <lersek@redhat.com> Cc: "Paolo Bonzini" <pbonzini@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19067 6f19259b-4bc3-4df7-8a09-765794883524
81 lines
2.0 KiB
C
81 lines
2.0 KiB
C
/** @file
|
|
IA-32 processor specific functions to enable SMM profile.
|
|
|
|
Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
|
|
This program and the accompanying materials
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
**/
|
|
|
|
#include "PiSmmCpuDxeSmm.h"
|
|
#include "SmmProfileInternal.h"
|
|
|
|
/**
|
|
Create SMM page table for S3 path.
|
|
|
|
**/
|
|
VOID
|
|
InitSmmS3Cr3 (
|
|
VOID
|
|
)
|
|
{
|
|
mSmmS3ResumeState->SmmS3Cr3 = Gen4GPageTable (0, TRUE);
|
|
|
|
return ;
|
|
}
|
|
|
|
/**
|
|
Allocate pages for creating 4KB-page based on 2MB-page when page fault happens.
|
|
32-bit firmware does not need it.
|
|
|
|
**/
|
|
VOID
|
|
InitPagesForPFHandler (
|
|
VOID
|
|
)
|
|
{
|
|
}
|
|
|
|
/**
|
|
Update page table to map the memory correctly in order to make the instruction
|
|
which caused page fault execute successfully. And it also save the original page
|
|
table to be restored in single-step exception. 32-bit firmware does not need it.
|
|
|
|
@param PageTable PageTable Address.
|
|
@param PFAddress The memory address which caused page fault exception.
|
|
@param CpuIndex The index of the processor.
|
|
@param ErrorCode The Error code of exception.
|
|
@param IsValidPFAddress The flag indicates if SMM profile data need be added.
|
|
|
|
**/
|
|
VOID
|
|
RestorePageTableAbove4G (
|
|
UINT64 *PageTable,
|
|
UINT64 PFAddress,
|
|
UINTN CpuIndex,
|
|
UINTN ErrorCode,
|
|
BOOLEAN *IsValidPFAddress
|
|
)
|
|
{
|
|
}
|
|
|
|
/**
|
|
Clear TF in FLAGS.
|
|
|
|
@param SystemContext A pointer to the processor context when
|
|
the interrupt occurred on the processor.
|
|
|
|
**/
|
|
VOID
|
|
ClearTrapFlag (
|
|
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
|
)
|
|
{
|
|
SystemContext.SystemContextIa32->Eflags &= (UINTN) ~BIT8;
|
|
}
|