summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/CpuDxe/CpuPageTable.c
diff options
context:
space:
mode:
Diffstat (limited to 'UefiCpuPkg/CpuDxe/CpuPageTable.c')
-rw-r--r--UefiCpuPkg/CpuDxe/CpuPageTable.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/CpuDxe/CpuPageTable.c
index 850eed60e7..df021798c0 100644
--- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
+++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
@@ -136,7 +136,14 @@ IsInSmm (
mSmmBase2->InSmm (mSmmBase2, &InSmm);
}
- return InSmm;
+ //
+ // mSmmBase2->InSmm() can only detect if the caller is running in SMRAM
+ // or from SMM driver. It cannot tell if the caller is running in SMM mode.
+ // Check page table base address to guarantee that because SMM mode willl
+ // load its own page table.
+ //
+ return (InSmm &&
+ mPagingContext.ContextData.X64.PageTableBase != (UINT64)AsmReadCr3());
}
/**