summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kinney <michael.d.kinney@intel.com>2015-11-03 02:06:57 +0000
committermdkinney <mdkinney@Edk2>2015-11-03 02:06:57 +0000
commit229fd9e7aa1c5ca9cfac7fcc0d49f0d8534e4c0c (patch)
tree330cdd8f1e6ab014c404e4c64dfb69a0ad2302bb
parentf6b0cb17b1b0edff35b2e73e3bc9085769f13eca (diff)
downloadedk2-229fd9e7aa1c5ca9cfac7fcc0d49f0d8534e4c0c.zip
edk2-229fd9e7aa1c5ca9cfac7fcc0d49f0d8534e4c0c.tar.gz
edk2-229fd9e7aa1c5ca9cfac7fcc0d49f0d8534e4c0c.tar.bz2
MdeModulePkg: PiSmmCore: Remove confusing CopyMem() of SMM_ENTRY_CONTEXT
A subset of fields in the EFI_SMM_SYSTEM_TABLE2 structure are identical to the fields in the SMM_ENTRY_CONTEXT structure. CopyMem() is used to transfer the contents of the SMM_ENTRY_CONTEXT structure into the EFI_SMM_SYSTEM_TABLE2. This is confusing because SMM_ENTRY_CONTEXT is not used in the declaration of EFI_SMM_SYSTEM_TABLE2 and field contents are transferred without any reference to individual field names (e.g. CurrentlyExecutingCpu). In order to make the code easier to maintain and understand, the CopyMem() is replaced with statements that transfer each field of SMM_ENTRY_CONTEXT into EFI_SMM_SYSTEM_TABLE2. Reported-by: Laszlo Ersek <lersek@redhat.com> Link: http://article.gmane.org/gmane.comp.bios.edk2.devel/3567 Cc: Feng Tian <feng.tian@intel.com> Cc: Jeff Fan <jeff.fan@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18716 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmCore.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 496638a..cc7ccec 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -432,9 +432,13 @@ SmmEntryPoint (
PERF_START (NULL, "SMM", NULL, 0) ;
//
- // Update SMST using the context
+ // Update SMST with contents of the SmmEntryContext structure
//
- CopyMem (&gSmmCoreSmst.SmmStartupThisAp, SmmEntryContext, sizeof (EFI_SMM_ENTRY_CONTEXT));
+ gSmmCoreSmst.SmmStartupThisAp = SmmEntryContext->SmmStartupThisAp;
+ gSmmCoreSmst.CurrentlyExecutingCpu = SmmEntryContext->CurrentlyExecutingCpu;
+ gSmmCoreSmst.NumberOfCpus = SmmEntryContext->NumberOfCpus;
+ gSmmCoreSmst.CpuSaveStateSize = SmmEntryContext->CpuSaveStateSize;
+ gSmmCoreSmst.CpuSaveState = SmmEntryContext->CpuSaveState;
//
// Call platform hook before Smm Dispatch