From patchwork Thu Nov 13 11:16:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 40735 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 39978240ED for ; Thu, 13 Nov 2014 11:17:02 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id c41sf9258708eek.8 for ; Thu, 13 Nov 2014 03:17:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=WjHeZbgtitwvz3d2qK8Ub9G49zDuWnSIh0DLkIOyNuw=; b=JRbf9CRbn2x6UjbJp0imYJbJ0Q/oC8IG6u6x+KOiDZK3FS2pbBYLWhwl4k2+sBfjQW TFThtsNES04lUla48xQttr6Ws48xtIjvh5HuDh4Nd6K1FvPmUW4CMSwlj4QG4sLeoPs5 zJ2H5FvXB/mVW1dTD2Gb1221ksP/GNekBHisW1dMCVHYkutnwtOfBu3tnXv/s1qoRcTK P7faGhOhWvrmsk0syK2oQEks4P5y3AzstYHEoxNOShCJRU7TAV3E2jgwQxlzWBKM2Qs+ A3K0MTUHdFlTmnk5+4QLFT0mjf02Xsxy4aOWfPiis2OFqiNo5nH+FkoRbiS2+meUggL8 j9Jw== X-Gm-Message-State: ALoCoQkjOw9It8tS+fcZlG90Z3cRJ2UJNkDD5RN0b5j8sf3Or2e1say0pQdRkUcHOWJkd3n/XL1a X-Received: by 10.112.50.243 with SMTP id f19mr5591062lbo.1.1415877421452; Thu, 13 Nov 2014 03:17:01 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.5 with SMTP id ca5ls622734lad.68.gmail; Thu, 13 Nov 2014 03:17:01 -0800 (PST) X-Received: by 10.112.135.197 with SMTP id pu5mr1838527lbb.22.1415877421073; Thu, 13 Nov 2014 03:17:01 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id q9si37975333lag.92.2014.11.13.03.17.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Nov 2014 03:17:01 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id q1so13066367lam.38 for ; Thu, 13 Nov 2014 03:17:01 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr1838344lab.40.1415877420978; Thu, 13 Nov 2014 03:17:00 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp572473lbc; Thu, 13 Nov 2014 03:17:00 -0800 (PST) X-Received: by 10.107.39.5 with SMTP id n5mr1521466ion.72.1415877419205; Thu, 13 Nov 2014 03:16:59 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id e12si39984344icc.22.2014.11.13.03.16.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Nov 2014 03:16:59 -0800 (PST) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XosOQ-0006cm-UW; Thu, 13 Nov 2014 11:16:50 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XosOP-0006cb-GS for edk2-devel@lists.sourceforge.net; Thu, 13 Nov 2014 11:16:49 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=lersek@redhat.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1XosOO-0007Rj-ER for edk2-devel@lists.sourceforge.net; Thu, 13 Nov 2014 11:16:49 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sADBGgKY030387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 13 Nov 2014 06:16:42 -0500 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sADBGTn2018997 for ; Thu, 13 Nov 2014 06:16:41 -0500 From: Laszlo Ersek To: edk2-devel@lists.sourceforge.net Date: Thu, 13 Nov 2014 12:16:22 +0100 Message-Id: <1415877385-18341-5-git-send-email-lersek@redhat.com> In-Reply-To: <1415877385-18341-1-git-send-email-lersek@redhat.com> References: <1415877385-18341-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -2.5 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -1.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1XosOO-0007Rj-ER Subject: [edk2] [PATCH v2 4/7] OvmfPkg: QemuVideoDxe: the VBE shim needs no 64-bit shifts (VS2010) X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Scott Duplichan 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 [lersek@redhat.com: dropped now superfluous outermost parens; commit msg] Signed-off-by: Laszlo Ersek --- OvmfPkg/QemuVideoDxe/VbeShim.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/VbeShim.c b/OvmfPkg/QemuVideoDxe/VbeShim.c index 81c1166..6bb175b 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__));