UefiCpuPkg PiSmmCpuDxeSmm: Remove redundant code to set IDT range to RO
authorStar Zeng <star.zeng@intel.com>
Fri, 12 Jan 2018 04:59:03 +0000 (12:59 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 15 Jan 2018 02:41:16 +0000 (10:41 +0800)
AllocateCodePages() is used to allocate buffer for IDT range,
the code pages will be set to RO in SetMemMapAttributes(),
then the code to set IDT range to RO in PatchGdtIdtMap() is
redundant and could be removed.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c

index 16664f3..2a4a298 100644 (file)
@@ -803,11 +803,10 @@ PatchGdtIdtMap (
 \r
   BaseAddress = gcSmiIdtr.Base;\r
   Size = ALIGN_VALUE(gcSmiIdtr.Limit + 1, SIZE_4KB);\r
-  SmmSetMemoryAttributes (\r
-    BaseAddress,\r
-    Size,\r
-    EFI_MEMORY_RO\r
-    );\r
+  //\r
+  // The range should have been set to RO\r
+  // if it is allocated with EfiRuntimeServicesCode.\r
+  //\r
   SmmSetMemoryAttributes (\r
     BaseAddress,\r
     Size,\r