]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
UefiCpuPkg/CpuDxe: Enable protection for newly added page table
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / SmramSaveState.c
index c37e9e8302af3c8ce1d9b1dc901dd8b6a602a6d5..3188d438181ccbed40e9d981e62dd4b8dfe792a9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Provides services to access SMRAM Save State Map\r
 \r
-Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -687,6 +687,14 @@ InstallSmiHandler (
 {\r
   PROCESSOR_SMM_DESCRIPTOR  *Psd;\r
 \r
+  //\r
+  // Initialize PROCESSOR_SMM_DESCRIPTOR\r
+  //\r
+  Psd = (PROCESSOR_SMM_DESCRIPTOR *)(VOID *)((UINTN)SmBase + SMM_PSD_OFFSET);\r
+  CopyMem (Psd, &gcPsd, sizeof (gcPsd));\r
+  Psd->SmmGdtPtr = (UINT64)GdtBase;\r
+  Psd->SmmGdtSize = (UINT32)GdtSize;\r
+\r
   if (SmmCpuFeaturesGetSmiHandlerSize () != 0) {\r
     //\r
     // Install SMI handler provided by library\r
@@ -705,14 +713,6 @@ InstallSmiHandler (
     return;\r
   }\r
 \r
-  //\r
-  // Initialize PROCESSOR_SMM_DESCRIPTOR\r
-  //\r
-  Psd = (PROCESSOR_SMM_DESCRIPTOR *)(VOID *)(UINTN)(SmBase + SMM_PSD_OFFSET);\r
-  CopyMem (Psd, &gcPsd, sizeof (gcPsd));\r
-  Psd->SmmGdtPtr = (UINT64)GdtBase;\r
-  Psd->SmmGdtSize = (UINT32)GdtSize;\r
-\r
   //\r
   // Initialize values in template before copy\r
   //\r
@@ -731,7 +731,7 @@ InstallSmiHandler (
   // Copy template to CPU specific SMI handler location\r
   //\r
   CopyMem (\r
-    (VOID*)(UINTN)(SmBase + SMM_HANDLER_OFFSET),\r
+    (VOID*)((UINTN)SmBase + SMM_HANDLER_OFFSET),\r
     (VOID*)gcSmiHandlerTemplate,\r
     gcSmiHandlerSize\r
     );\r