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
CopyMem (VbeInfo->Signature, "VESA", 4);\r
VbeInfo->VesaVersion = 0x0300;\r
\r
CopyMem (VbeInfo->Signature, "VESA", 4);\r
VbeInfo->VesaVersion = 0x0300;\r
\r
- VbeInfo->OemNameAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);\r
+ VbeInfo->OemNameAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;\r
CopyMem (Ptr, "QEMU", 5);\r
Ptr += 5;\r
\r
VbeInfo->Capabilities = BIT0; // DAC can be switched into 8-bit mode\r
\r
CopyMem (Ptr, "QEMU", 5);\r
Ptr += 5;\r
\r
VbeInfo->Capabilities = BIT0; // DAC can be switched into 8-bit mode\r
\r
- VbeInfo->ModeListAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);\r
+ VbeInfo->ModeListAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;\r
*(UINT16*)Ptr = 0x00f1; // mode number\r
Ptr += 2;\r
*(UINT16*)Ptr = 0xFFFF; // mode list terminator\r
*(UINT16*)Ptr = 0x00f1; // mode number\r
Ptr += 2;\r
*(UINT16*)Ptr = 0xFFFF; // mode list terminator\r
VbeInfo->VideoMem64K = (UINT16)((1024 * 768 * 4 + 65535) / 65536);\r
VbeInfo->OemSoftwareVersion = 0x0000;\r
\r
VbeInfo->VideoMem64K = (UINT16)((1024 * 768 * 4 + 65535) / 65536);\r
VbeInfo->OemSoftwareVersion = 0x0000;\r
\r
- VbeInfo->VendorNameAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);\r
+ VbeInfo->VendorNameAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;\r
CopyMem (Ptr, "OVMF", 5);\r
Ptr += 5;\r
\r
CopyMem (Ptr, "OVMF", 5);\r
Ptr += 5;\r
\r
- VbeInfo->ProductNameAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);\r
+ VbeInfo->ProductNameAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;\r
Printed = AsciiSPrint ((CHAR8 *)Ptr,\r
sizeof VbeInfoFull->Buffer - (Ptr - VbeInfoFull->Buffer), "%s",\r
CardName);\r
Ptr += Printed + 1;\r
\r
Printed = AsciiSPrint ((CHAR8 *)Ptr,\r
sizeof VbeInfoFull->Buffer - (Ptr - VbeInfoFull->Buffer), "%s",\r
CardName);\r
Ptr += Printed + 1;\r
\r
- VbeInfo->ProductRevAddress = (UINT32)(SegmentC << 12 | (UINT16)(UINTN)Ptr);\r
+ VbeInfo->ProductRevAddress = (UINT32)SegmentC << 12 | (UINT16)(UINTN)Ptr;\r
CopyMem (Ptr, mProductRevision, sizeof mProductRevision);\r
Ptr += sizeof mProductRevision;\r
\r
CopyMem (Ptr, mProductRevision, sizeof mProductRevision);\r
Ptr += sizeof mProductRevision;\r
\r
//\r
// Second, point the Int10h vector at the shim.\r
//\r
//\r
// Second, point the Int10h vector at the shim.\r
//\r
- Int0x10->Segment = (UINT16) (SegmentC >> 4);\r
+ Int0x10->Segment = (UINT16) ((UINT32)SegmentC >> 4);\r
Int0x10->Offset = (UINT16) ((UINTN) (VbeModeInfo + 1) - SegmentC);\r
\r
DEBUG ((EFI_D_INFO, "%a: VBE shim installed\n", __FUNCTION__));\r
Int0x10->Offset = (UINT16) ((UINTN) (VbeModeInfo + 1) - SegmentC);\r
\r
DEBUG ((EFI_D_INFO, "%a: VBE shim installed\n", __FUNCTION__));\r