From b5c9bbff8e9c2613dc72ab4dde6d4ddc1e1217bd Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Thu, 25 Jul 2024 13:56:37 +0800 Subject: UefiCpuPkg:CpuDeadLoop in SmiPFHandler if SMM profile is disabled Always call CpuDeadLoop() in SmiPFHandler if SMM profile is disabled. Previously, when PcdCpuSmmRestrictedMemoryAccess is FALSE, SMM page table only covers [0, 4g]. When code access to range above 4g happens, SmiPFHandler will map the accessed not-present range to present. After we always create full mapping page table, the dynamic page table creation logic is only needed when SMM profile is enabled. So we use CpuDeadLoop() in SmiPFHandler to cover the all the PF exception when SMM profile is disabled Considering that [0, 4g] is always mapped in SMM page table, we also modify the IA32 SmiPFHandler code to be aligned with X64 code. Signed-off-by: Dun Tan --- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c index 5c00c0fa8c..5170be342f 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c @@ -212,7 +212,7 @@ SmiPFHandler ( ); } else { DumpCpuContext (InterruptType, SystemContext); - SmiDefaultPFHandler (); + CpuDeadLoop (); } Exit: diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c index a7b02981dc..09a9c1c49f 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c @@ -1,7 +1,7 @@ /** @file Page Fault (#PF) handler for X64 processors -Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -982,7 +982,8 @@ SmiPFHandler ( SystemContext.SystemContextX64->ExceptionData ); } else { - SmiDefaultPFHandler (); + DumpCpuContext (InterruptType, SystemContext); + CpuDeadLoop (); } Exit: -- cgit v1.2.3