]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
MdeModulePkg/PiSmmCore: Cache CommunicationBuffer info before using it
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / SmmProfile.c
index 329574ebb24ebcc155b2d6ceee8f35710b37504c..c1a48d100e0fa42cf42bd0921789150f866f69e1 100644 (file)
@@ -29,11 +29,6 @@ UINTN                     mSmmProfileSize;
 //\r
 UINTN                     mMsrDsAreaSize   = SMM_PROFILE_DTS_SIZE;\r
 \r
-//\r
-// The flag indicates if execute-disable is supported by processor.\r
-//\r
-BOOLEAN                   mXdSupported     = TRUE;\r
-\r
 //\r
 // The flag indicates if execute-disable is enabled on processor.\r
 //\r
@@ -529,6 +524,12 @@ InitPaging (
         //\r
         continue;\r
       }\r
+      if ((*Pde & IA32_PG_PS) != 0) {\r
+        //\r
+        // This is 1G entry, skip it\r
+        //\r
+        continue;\r
+      }\r
       Pte = (UINT64 *)(UINTN)(*Pde & PHYSICAL_ADDRESS_MASK);\r
       if (Pte == 0) {\r
         continue;\r
@@ -587,6 +588,15 @@ InitPaging (
         //\r
         continue;\r
       }\r
+      if ((*Pde & IA32_PG_PS) != 0) {\r
+        //\r
+        // This is 1G entry, set NX bit and skip it\r
+        //\r
+        if (mXdSupported) {\r
+          *Pde = *Pde | IA32_PG_NX;\r
+        }\r
+        continue;\r
+      }\r
       Pte = (UINT64 *)(UINTN)(*Pde & PHYSICAL_ADDRESS_MASK);\r
       if (Pte == 0) {\r
         continue;\r
@@ -975,25 +985,6 @@ CheckFeatureSupported (
   }\r
 }\r
 \r
-/**\r
-  Enable XD feature.\r
-\r
-**/\r
-VOID\r
-ActivateXd (\r
-  VOID\r
-  )\r
-{\r
-  UINT64           MsrRegisters;\r
-\r
-  MsrRegisters = AsmReadMsr64 (MSR_EFER);\r
-  if ((MsrRegisters & MSR_EFER_XD) != 0) {\r
-    return ;\r
-  }\r
-  MsrRegisters |= MSR_EFER_XD;\r
-  AsmWriteMsr64 (MSR_EFER, MsrRegisters);\r
-}\r
-\r
 /**\r
   Enable single step.\r
 \r
@@ -1384,5 +1375,8 @@ InitIdtr (
   VOID\r
   )\r
 {\r
-  SmmRegisterExceptionHandler (&mSmmCpuService, EXCEPT_IA32_DEBUG, DebugExceptionHandler);\r
+  EFI_STATUS                        Status;\r
+\r
+  Status = SmmRegisterExceptionHandler (&mSmmCpuService, EXCEPT_IA32_DEBUG, DebugExceptionHandler);\r
+  ASSERT_EFI_ERROR (Status);\r
 }\r