Reviewed-by: jiewen....@intel.com > -----Original Message----- > From: Vanguput, Narendra K > Sent: Thursday, March 7, 2019 3:15 AM > To: edk2-devel@lists.01.org > Cc: Vanguput, Narendra K <narendra.k.vangu...@intel.com>; Dong, Eric > <eric.d...@intel.com>; Ni, Ray <ray...@intel.com>; Laszlo Ersek > <ler...@redhat.com>; Yao, Jiewen <jiewen....@intel.com> > Subject: [PATCH v2] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand > paging in SMM > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593 > > For every SMI occurrence, save and restore CR2 register only when SMM > on-demand paging support is enabled in 64 bit operation mode. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Vanguput Narendra K <narendra.k.vangu...@intel.com> > Cc: Eric Dong <eric.d...@intel.com> > Cc: Ray Ni <ray...@intel.com> > Cc: Laszlo Ersek <ler...@redhat.com> > Cc: Yao Jiewen <jiewen....@intel.com> > --- > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c > b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c > index 3b0b3b52ac..5be4a2b020 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c > @@ -1111,10 +1111,12 @@ SmiRendezvous ( > > ASSERT(CpuIndex < mMaxNumberOfCpus); > > - // > - // Save Cr2 because Page Fault exception in SMM may override its value > - // > - Cr2 = AsmReadCr2 (); > + if ((sizeof (UINTN) == sizeof (UINT64)) && (!PcdGetBool > (PcdCpuSmmStaticPageTable))) { > + // > + // Save Cr2 because Page Fault exception in SMM may override its > value > + // > + Cr2 = AsmReadCr2 (); > + } > > // > // Perform CPU specific entry hooks > @@ -1253,10 +1255,12 @@ SmiRendezvous ( > > Exit: > SmmCpuFeaturesRendezvousExit (CpuIndex); > - // > - // Restore Cr2 > - // > - AsmWriteCr2 (Cr2); > + if ((sizeof (UINTN) == sizeof (UINT64)) && (!PcdGetBool > (PcdCpuSmmStaticPageTable))) { > + // > + // Restore Cr2 > + // > + AsmWriteCr2 (Cr2); > + } > } > > /** > -- > 2.16.2.windows.1
_______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel