public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiCpuPkg:PiSmmCpu: Set correct attribute on split.
@ 2016-11-29  7:39 Jiewen Yao
  2016-11-29 21:54 ` Laszlo Ersek
  0 siblings, 1 reply; 6+ messages in thread
From: Jiewen Yao @ 2016-11-29  7:39 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jeff Fan, Michael D Kinney, Laszlo Ersek

PiSmmCpu driver may split page for page attribute request.
Current logic will propagate the super page attribute attribute.
However, it might be wrong because we cannot clear protection
without touch super page attribute.

We should always clear protection on super page and set
protection on end page for easy clear later.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
index accc11e..d0f41a8 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
@@ -303,7 +303,7 @@ SplitPage (
       for (Index = 0; Index < SIZE_4KB / sizeof(UINT64); Index++) {
         NewPageEntry[Index] = BaseAddress + SIZE_4KB * Index + ((*PageEntry) & PAGE_PROGATE_BITS);
       }
-      (*PageEntry) = (UINT64)(UINTN)NewPageEntry + ((*PageEntry) & PAGE_PROGATE_BITS);
+      (*PageEntry) = (UINT64)(UINTN)NewPageEntry + PAGE_ATTRIBUTE_BITS;
       return RETURN_SUCCESS;
     } else {
       return RETURN_UNSUPPORTED;
@@ -324,7 +324,7 @@ SplitPage (
       for (Index = 0; Index < SIZE_4KB / sizeof(UINT64); Index++) {
         NewPageEntry[Index] = BaseAddress + SIZE_2MB * Index + IA32_PG_PS + ((*PageEntry) & PAGE_PROGATE_BITS);
       }
-      (*PageEntry) = (UINT64)(UINTN)NewPageEntry + ((*PageEntry) & PAGE_PROGATE_BITS);
+      (*PageEntry) = (UINT64)(UINTN)NewPageEntry + PAGE_ATTRIBUTE_BITS;
       return RETURN_SUCCESS;
     } else {
       return RETURN_UNSUPPORTED;
-- 
2.7.4.windows.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-30  9:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29  7:39 [PATCH] UefiCpuPkg:PiSmmCpu: Set correct attribute on split Jiewen Yao
2016-11-29 21:54 ` Laszlo Ersek
2016-11-30  1:47   ` Yao, Jiewen
2016-11-30  5:50     ` Yao, Jiewen
2016-11-30  8:29       ` Laszlo Ersek
2016-11-30  8:35       ` Fan, Jeff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox