Revision: 16385
          http://sourceforge.net/p/edk2/code/16385
Author:   lersek
Date:     2014-11-14 10:23:55 +0000 (Fri, 14 Nov 2014)
Log Message:
-----------
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 <[email protected]>

[[email protected]: dropped now superfluous outermost parens; commit msg]

Signed-off-by: Laszlo Ersek <[email protected]>

Build-tested-by: Scott Duplichan <[email protected]>

Reviewed-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/OvmfPkg/QemuVideoDxe/VbeShim.c

Modified: trunk/edk2/OvmfPkg/QemuVideoDxe/VbeShim.c
===================================================================
--- trunk/edk2/OvmfPkg/QemuVideoDxe/VbeShim.c   2014-11-14 10:23:43 UTC (rev 
16384)
+++ trunk/edk2/OvmfPkg/QemuVideoDxe/VbeShim.c   2014-11-14 10:23:55 UTC (rev 
16385)
@@ -153,13 +153,13 @@
   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 @@
   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 @@
   //
   // 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__));


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to