UefiCpuPkg/PiSmmCpuDxeSmm: Consume new APIs
Consuming PeCoffSerachImageBase() from PeCoffGetEntrypointLib and consuming DumpCpuContext() from CpuExceptionHandlerLib to replace its own implementation. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Page Fault (#PF) handler for X64 processors
|
||||
|
||||
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
@@ -802,8 +802,8 @@ SmiDefaultPFHandler (
|
||||
VOID
|
||||
EFIAPI
|
||||
SmiPFHandler (
|
||||
IN EFI_EXCEPTION_TYPE InterruptType,
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
IN EFI_EXCEPTION_TYPE InterruptType,
|
||||
IN EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
UINTN PFAddress;
|
||||
@@ -817,6 +817,7 @@ SmiPFHandler (
|
||||
PFAddress = AsmReadCr2 ();
|
||||
|
||||
if (mCpuSmmStaticPageTable && (PFAddress >= LShiftU64 (1, (mPhysicalAddressBits - 1)))) {
|
||||
DumpCpuContext (InterruptType, SystemContext);
|
||||
DEBUG ((DEBUG_ERROR, "Do not support address 0x%lx by processor!\n", PFAddress));
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
@@ -827,6 +828,7 @@ SmiPFHandler (
|
||||
//
|
||||
if ((PFAddress >= mCpuHotPlugData.SmrrBase) &&
|
||||
(PFAddress < (mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize))) {
|
||||
DumpCpuContext (InterruptType, SystemContext);
|
||||
CpuIndex = GetCpuIndex ();
|
||||
GuardPageAddress = (mSmmStackArrayBase + EFI_PAGE_SIZE + CpuIndex * mSmmStackSize);
|
||||
if ((FeaturePcdGet (PcdCpuSmmStackGuard)) &&
|
||||
@@ -834,15 +836,6 @@ SmiPFHandler (
|
||||
(PFAddress < (GuardPageAddress + EFI_PAGE_SIZE))) {
|
||||
DEBUG ((DEBUG_ERROR, "SMM stack overflow!\n"));
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "SMM exception data - 0x%lx(", SystemContext.SystemContextX64->ExceptionData));
|
||||
DEBUG ((DEBUG_ERROR, "I:%x, R:%x, U:%x, W:%x, P:%x",
|
||||
(SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0,
|
||||
(SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_RSVD) != 0,
|
||||
(SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_US) != 0,
|
||||
(SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_WR) != 0,
|
||||
(SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_P) != 0
|
||||
));
|
||||
DEBUG ((DEBUG_ERROR, ")\n"));
|
||||
if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "SMM exception at execution (0x%lx)\n", PFAddress));
|
||||
DEBUG_CODE (
|
||||
@@ -863,6 +856,7 @@ SmiPFHandler (
|
||||
//
|
||||
if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
|
||||
(PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
|
||||
DumpCpuContext (InterruptType, SystemContext);
|
||||
if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0) {
|
||||
DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM range after SMM is locked!\n", PFAddress));
|
||||
DEBUG_CODE (
|
||||
|
Reference in New Issue
Block a user