diff options
author | Jiewen Yao <jiewen.yao@intel.com> | 2016-11-17 21:32:25 +0800 |
---|---|---|
committer | Jiewen Yao <jiewen.yao@intel.com> | 2016-11-18 10:53:59 +0800 |
commit | 750ec4cabd074e0d8d4958efc0788c20e229d352 (patch) | |
tree | 608461ac002cd23467b7bb86cecbeeb1c7661911 | |
parent | 0dc3fb06b270ee8b370c5b219ce590fcfe66d551 (diff) | |
download | edk2-platforms-750ec4cabd074e0d8d4958efc0788c20e229d352.tar.xz |
UefiCpuPkg/PiSmmCpu: Check XdSupport before set NX.
When XD is not supported, the BIT63 is reserved.
We should not set BIT63 in the page table.
Test OVMF IA32/IA32X64 with XD enabled/disabled.
Analyzed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
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>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
-rw-r--r-- | UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index b4f8861607..c85e025424 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -209,10 +209,12 @@ ConvertPageEntryAttribute ( }
}
if ((Attributes & EFI_MEMORY_XP) != 0) {
- if (IsSet) {
- NewPageEntry |= IA32_PG_NX;
- } else {
- NewPageEntry &= ~IA32_PG_NX;
+ if (mXdSupported) {
+ if (IsSet) {
+ NewPageEntry |= IA32_PG_NX;
+ } else {
+ NewPageEntry &= ~IA32_PG_NX;
+ }
}
}
*PageEntry = NewPageEntry;
|