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>
This commit is contained in:
Jiewen Yao 2016-11-17 21:32:25 +08:00
parent 0dc3fb06b2
commit 750ec4cabd
1 changed files with 6 additions and 4 deletions

View File

@ -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;