From patchwork Wed Nov 12 14:03:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 40674 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A9689206A5 for ; Wed, 12 Nov 2014 14:04:57 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gq15sf7789642lab.2 for ; Wed, 12 Nov 2014 06:04:56 -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=N5z8hl8dwcL2JuEi0qX+feGyHfUgaF7D7ziU3FvTS5c=; b=VFVj9LgE3Xgew0CoPYHHLHiKIWUHTaPyQlXnv4tHb51LbYJXb1c+BT3GaB8LLyKnnU ZuJstf+KvAu5SQcBu9e4PVXLtZjrn2QrV0OhzJCw9KEJjGY6GTDmBF01VcrOoia0zFfq JmNRRKfJimMIGEiysRmvhBr2qcAnVsrzSj/D9N3gJwLJiZt5qAtL9lyA60VkPq6b9Vgq OrXCBVJh7TtAS0+Kmj5LO+ZUQrbmUk2asDiCrntcz5tkpac0Kq//s0tATDd0bUj6Ldc7 LBN4WWYbiDXhCRBtZ10lj8T3J7MsT8hslZAHq39ERuM8NOixFhn8AbQ+VEd1+bqd8PDk ABiw== X-Gm-Message-State: ALoCoQk4TiwmL8hSUerWBOGnI8f36gwHkuteXh+zwIFSwYnSQNYDseV+jZZ3f2sTQvvad+lbI5TC X-Received: by 10.112.138.202 with SMTP id qs10mr7938273lbb.5.1415801096316; Wed, 12 Nov 2014 06:04:56 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.196 with SMTP id da4ls323570lac.1.gmail; Wed, 12 Nov 2014 06:04:55 -0800 (PST) X-Received: by 10.152.5.100 with SMTP id r4mr42676077lar.26.1415801095966; Wed, 12 Nov 2014 06:04:55 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id ka2si35174795lbc.9.2014.11.12.06.04.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Nov 2014 06:04:55 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so2648950lbi.36 for ; Wed, 12 Nov 2014 06:04:55 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr42018891lbc.23.1415801095867; Wed, 12 Nov 2014 06:04:55 -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 ew9csp428855lbc; Wed, 12 Nov 2014 06:04:54 -0800 (PST) X-Received: by 10.52.118.8 with SMTP id ki8mr6735949vdb.85.1415801089813; Wed, 12 Nov 2014 06:04:49 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id x8si15109958vcq.77.2014.11.12.06.04.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 12 Nov 2014 06:04:49 -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 1XoYXD-00023q-RD; Wed, 12 Nov 2014 14:04:35 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XoYXC-00023g-31 for edk2-devel@lists.sourceforge.net; Wed, 12 Nov 2014 14:04:34 +0000 Received-SPF: pass (sog-mx-3.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-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1XoYXB-0000lO-0X for edk2-devel@lists.sourceforge.net; Wed, 12 Nov 2014 14:04:34 +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 sACE4OrG016534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Nov 2014 09:04:24 -0500 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-88.ams2.redhat.com [10.36.116.88]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sACE457S030648; Wed, 12 Nov 2014 09:04:21 -0500 From: Laszlo Ersek To: edk2-devel@lists.sourceforge.net, jordan.l.justen@intel.com, scott@notabs.org, qin.long@intel.com Date: Wed, 12 Nov 2014 15:03:58 +0100 Message-Id: <1415801041-17550-5-git-send-email-lersek@redhat.com> In-Reply-To: <1415801041-17550-1-git-send-email-lersek@redhat.com> References: <1415801041-17550-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -2.1 (--) 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 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1XoYXB-0000lO-0X Subject: [edk2] [PATCH 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.217.177 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 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__));