summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/QemuVideoDxe
diff options
context:
space:
mode:
authorScott Duplichan <scott@notabs.org>2014-11-14 10:23:55 +0000
committerlersek <lersek@Edk2>2014-11-14 10:23:55 +0000
commit75f8e3aaff4d77ec2a04c14633d63b67c651edda (patch)
tree9dd1c337cc88dea3db15304f0b4a076e09b9c904 /OvmfPkg/QemuVideoDxe
parentf7e899c7c74e5983e40e32257b33918ea6f466f0 (diff)
downloadedk2-75f8e3aaff4d77ec2a04c14633d63b67c651edda.tar.gz
edk2-75f8e3aaff4d77ec2a04c14633d63b67c651edda.tar.bz2
edk2-75f8e3aaff4d77ec2a04c14633d63b67c651edda.zip
OvmfPkg: QemuVideoDxe: the VBE shim needs no 64-bit shifts (VS2010)
The SegmentC local variable has type EFI_PHYSICAL_ADDRESS for (justified) style reasons. However, the 64-bit bit-shifts that it undergoes result in intrinsic calls when built with VS2010 for Ia32 / NOOPT. The concrete value of SegmentC, 0xC0000, and the results of the bitops that are based on it, are statically computeable. Cast SegmentC to UINT32 before subjecting it to bitwise operations; we can see in advance that this won't lead to range loss. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Scott Duplichan <scott@notabs.org> [lersek@redhat.com: dropped now superfluous outermost parens; commit msg] Signed-off-by: Laszlo Ersek <lersek@redhat.com> Build-tested-by: Scott Duplichan <scott@notabs.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16385 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/QemuVideoDxe')
-rw-r--r--OvmfPkg/QemuVideoDxe/VbeShim.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/OvmfPkg/QemuVideoDxe/VbeShim.c b/OvmfPkg/QemuVideoDxe/VbeShim.c
index 81c11664f4..6bb175bfd4 100644
--- a/OvmfPkg/QemuVideoDxe/VbeShim.c
+++ b/OvmfPkg/QemuVideoDxe/VbeShim.c
@@ -153,13 +153,13 @@ InstallVbeShim (
CopyMem (VbeInfo->Signature, "VESA", 4);
VbeInfo->VesaVersion = 0x0300;
- VbeInfo->OemNameAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);
+ VbeInfo->OemNameAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;
CopyMem (Ptr, "QEMU", 5);
Ptr += 5;
VbeInfo->Capabilities = BIT0; // DAC can be switched into 8-bit mode
- VbeInfo->ModeListAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);
+ VbeInfo->ModeListAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;
*(UINT16*)Ptr = 0x00f1; // mode number
Ptr += 2;
*(UINT16*)Ptr = 0xFFFF; // mode list terminator
@@ -168,17 +168,17 @@ InstallVbeShim (
VbeInfo->VideoMem64K = (UINT16)((1024 * 768 * 4 + 65535) / 65536);
VbeInfo->OemSoftwareVersion = 0x0000;
- VbeInfo->VendorNameAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);
+ VbeInfo->VendorNameAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;
CopyMem (Ptr, "OVMF", 5);
Ptr += 5;
- VbeInfo->ProductNameAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);
+ VbeInfo->ProductNameAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;
Printed = AsciiSPrint ((CHAR8 *)Ptr,
sizeof VbeInfoFull->Buffer - (Ptr - VbeInfoFull->Buffer), "%s",
CardName);
Ptr += Printed + 1;
- VbeInfo->ProductRevAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);
+ VbeInfo->ProductRevAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;
CopyMem (Ptr, mProductRevision, sizeof mProductRevision);
Ptr += sizeof mProductRevision;
@@ -268,7 +268,7 @@ InstallVbeShim (
//
// Second, point the Int10h vector at the shim.
//
- Int0x10->Segment = (UINT16) (SegmentC >> 4);
+ Int0x10->Segment = (UINT16) ((UINT32)SegmentC >> 4);
Int0x10->Offset = (UINT16) ((UINTN) (VbeModeInfo + 1) - SegmentC);
DEBUG ((EFI_D_INFO, "%a: VBE shim installed\n", __FUNCTION__));