From: Star Zeng Date: Fri, 12 Jan 2018 04:59:03 +0000 (+0800) Subject: UefiCpuPkg PiSmmCpuDxeSmm: Remove redundant code to set IDT range to RO X-Git-Tag: edk2-stable201903~2623 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=fe90d0d2ad3ed2e382fd1384fdf05969a95f2cdf;hp=6e601a4109d4a998596986718653048ae23de0a6 UefiCpuPkg PiSmmCpuDxeSmm: Remove redundant code to set IDT range to RO 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 Cc: Jian J Wang Cc: Eric Dong Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao --- diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index 16664f304c..2a4a298998 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -803,11 +803,10 @@ PatchGdtIdtMap ( BaseAddress = gcSmiIdtr.Base; Size = ALIGN_VALUE(gcSmiIdtr.Limit + 1, SIZE_4KB); - SmmSetMemoryAttributes ( - BaseAddress, - Size, - EFI_MEMORY_RO - ); + // + // The range should have been set to RO + // if it is allocated with EfiRuntimeServicesCode. + // SmmSetMemoryAttributes ( BaseAddress, Size,