summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2017-12-07 17:00:48 +0800
committerStar Zeng <star.zeng@intel.com>2017-12-08 12:29:24 +0800
commit1015fb3c1beb27eabd77e97f06f6b1012bacf3d8 (patch)
tree177694519c28f96cb3b75fc320f4ff9af50ee7f7 /UefiCpuPkg/PiSmmCpuDxeSmm
parent5d0e003c8ce2616c763f8edd4ac18f560d418e76 (diff)
downloadedk2-1015fb3c1beb27eabd77e97f06f6b1012bacf3d8.tar.gz
edk2-1015fb3c1beb27eabd77e97f06f6b1012bacf3d8.tar.bz2
edk2-1015fb3c1beb27eabd77e97f06f6b1012bacf3d8.zip
UefiCpuPkg PiSmmCpuDxeSmm: SMM profile and static paging mutual exclusion
SMM profile and static paging could not be enabled at the same time, this patch is to add check and comments to make sure it. Similar comments are also added for the case of static paging and heap guard for SMM. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c11
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c13
2 files changed, 20 insertions, 4 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index 6e1ffe7c62..9300a232e4 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -199,12 +199,21 @@ SetPageTableAttributes (
BOOLEAN PageTableSplitted;
//
- // Don't mark page table as read-only if heap guard is enabled.
+ // Don't mark page table to read-only if heap guard is enabled.
//
// BIT2: SMM page guard enabled
// BIT3: SMM pool guard enabled
//
if ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) {
+ DEBUG ((DEBUG_INFO, "Don't mark page table to read-only as heap guard is enabled\n"));
+ return ;
+ }
+
+ //
+ // Don't mark page table to read-only if SMM profile is enabled.
+ //
+ if (FeaturePcdGet (PcdCpuSmmProfileEnable)) {
+ DEBUG ((DEBUG_INFO, "Don't mark page table to read-only as SMM profile is enabled\n"));
return ;
}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 6478c6c3e3..0fe944fc18 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -919,17 +919,24 @@ SetPageTableAttributes (
//
// Don't do this if
// - no static page table; or
- // - SMM heap guard feature enabled
+ // - SMM heap guard feature enabled; or
// BIT2: SMM page guard enabled
// BIT3: SMM pool guard enabled
+ // - SMM profile feature enabled
//
if (!mCpuSmmStaticPageTable ||
- (PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) {
+ ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) ||
+ FeaturePcdGet (PcdCpuSmmProfileEnable)) {
//
- // Static paging and heap guard should not be enabled at the same time.
+ // Static paging and heap guard could not be enabled at the same time.
//
ASSERT (!(mCpuSmmStaticPageTable &&
(PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0));
+
+ //
+ // Static paging and SMM profile could not be enabled at the same time.
+ //
+ ASSERT (!(mCpuSmmStaticPageTable && FeaturePcdGet (PcdCpuSmmProfileEnable)));
return ;
}