audk/UefiCpuPkg/CpuDxe
Jian J Wang b72f487372 UefiCpuPkg/CpuDxe: fix incorrect check of SMM mode
Current IsInSmm() method makes use of gEfiSmmBase2ProtocolGuid.InSmm() to
check if current processor is in SMM mode or not. But this is not correct
because gEfiSmmBase2ProtocolGuid.InSmm() can only detect if the caller is
running in SMRAM or from SMM driver. It cannot guarantee if the caller is
running in SMM mode. Because SMM mode will load its own page table, adding
an extra check of saved DXE page table base address against current CR3
register value can help to get the correct answer for sure (in SMM mode or
not in SMM mode).

There's indiscriminate uses of Context.X64 and Context.Ia32 in code which
is not a good coding practice and will cause potential issue. In addition,
the related structure type definition is not packed and has also potential
issue. This will not be covered by this patch but be tracked by a bug below.

  https://bugzilla.tianocore.org/show_bug.cgi?id=1039

This is an issue caused by check-in at

  2a1408d1d7

Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
2018-07-20 10:34:11 +08:00
..
Ia32 UefiCpuPkg: Remove X86 ASM and S files 2018-06-07 15:27:36 +08:00
X64 UefiCpuPkg: Remove X86 ASM and S files 2018-06-07 15:27:36 +08:00
CpuDxe.c UefiCpuPkg: Clean up source files 2018-06-28 11:19:53 +08:00
CpuDxe.h UefiCpuPkg/CpuDxe: Enable protection for newly added page table 2017-12-12 10:14:51 +08:00
CpuDxe.inf UefiCpuPkg/CpuDxe: allow accessing (DXE) page table in SMM mode 2018-06-19 13:44:54 +08:00
CpuDxe.uni UefiCpuPkg: Clean up source files 2018-06-28 11:19:53 +08:00
CpuDxeExtra.uni UefiCpuPkg: Clean up source files 2018-06-28 11:19:53 +08:00
CpuGdt.c
CpuGdt.h
CpuMp.c UefiCpuPkg/CpuDxe: suppress invalid warning about uninitialized variable 2017-12-13 11:37:11 +08:00
CpuMp.h UefiCpuPkg CpuDxe: Update return status to follow spec. 2017-07-07 08:54:10 +08:00
CpuPageTable.c UefiCpuPkg/CpuDxe: fix incorrect check of SMM mode 2018-07-20 10:34:11 +08:00
CpuPageTable.h UefiCpuPkg/CpuDxe: Enable protection for newly added page table 2017-12-12 10:14:51 +08:00