]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/QemuVideoDxe: Bypass NULL pointer detection during VBE SHIM installing
authorJian J Wang <jian.j.wang@intel.com>
Mon, 9 Oct 2017 14:02:27 +0000 (22:02 +0800)
committerEric Dong <eric.dong@intel.com>
Wed, 11 Oct 2017 08:39:02 +0000 (16:39 +0800)
QemuVideoDxe driver will link VBE SHIM into page 0. If NULL pointer
detection is enabled, this driver will fail to load. NULL pointer detection
bypassing code is added to prevent such problem during boot.

Please note that Windows 7 will try to access VBE SHIM during boot if it's
installed, and then cause boot failure. This can be fixed by setting BIT7
of PcdNullPointerDetectionPropertyMask to disable NULL pointer detection
after EndOfDxe. As far as we know, there's no other OSs has such issue.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Ayellet Wolman <ayellet.wolman@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
OvmfPkg/QemuVideoDxe/VbeShim.c

index 577e07b0a8bf577d851eacda8b5d326d7fc31901..ff68c99e96a9a0b545c8f60face7d1aa8711c0a6 100644 (file)
@@ -77,3 +77,4 @@
 [Pcd]\r
   gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask\r
index e45a08e8873f15cdf366b0b4a537e6b579460392..8ba5522cde3ceca0d78e331c01ebdae29623a4fe 100644 (file)
@@ -75,6 +75,20 @@ InstallVbeShim (
   UINTN                Printed;\r
   VBE_MODE_INFO        *VbeModeInfo;\r
 \r
+  if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT0|BIT7)) == BIT0) {\r
+    DEBUG ((\r
+      DEBUG_WARN,\r
+      "%a: page 0 protected, not installing VBE shim\n",\r
+      __FUNCTION__\r
+      ));\r
+    DEBUG ((\r
+      DEBUG_WARN,\r
+      "%a: page 0 protection prevents Windows 7 from booting anyway\n",\r
+      __FUNCTION__\r
+      ));\r
+    return;\r
+  }\r
+\r
   Segment0 = 0x00000;\r
   SegmentC = 0xC0000;\r
   SegmentF = 0xF0000;\r