From nobody Thu Apr 25 07:54:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528348031162296.10358403675457; Wed, 6 Jun 2018 22:07:11 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 25AB1211A7581; Wed, 6 Jun 2018 22:07:10 -0700 (PDT) Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0331B21163716 for ; Wed, 6 Jun 2018 22:07:08 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id w10-v6so8497748wrk.9 for ; Wed, 06 Jun 2018 22:07:08 -0700 (PDT) Received: from m1cha-NB.localdomain ([2a02:908:5a3:da80:7a8d:2699:26c0:ba14]) by smtp.gmail.com with ESMTPSA id c10-v6sm14701088wrs.6.2018.06.06.22.07.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 22:07:05 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=sigmaepsilon92@gmail.com; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=0OmHRr7h8K1Fx3zqxqlKd3Gb3V6vDe0AEHZBbE2dolM=; b=AP3pKjqnzw+ihg8U0Wn1l3JHOm1opMbr6Q07uEWnlsBvD7zBBDZoeW5TEc0TBrZkHJ fvb5+9XnkBb8XukE1RSt/U9hRUB36jH1v45foXysmAdRFDbgAycwcP/N619p74ym1KSP x8pB6O1huUlpJFP4lXJ4OtPNHqUqWHvXBkOq3sti5mAIrsfkeK6anqnwDTBLTf7+LebN 5kXMRPcexSp7+k1G3xs4vF5hpVe9lyB1XZ0ukF6r/eSTWP9WduEskqEmiS5BlPDzVrSz KIn/if2kIFvIvV5UPV6YFCw66D/D/F7ggYlc8MIqmeGXSj90uiygISku93VogEVHz9O7 8BIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=0OmHRr7h8K1Fx3zqxqlKd3Gb3V6vDe0AEHZBbE2dolM=; b=llGH4WdMhptNJVwVd9q+vpIfkNrF1IuDOXYmMOp9hn0kuNAviOMLMkwxcaf0Or+Wqj Lh+YKRLBYJ5RDQ2WuCE4trNmWegB3mqX7EuT/wA+me5jmguTCRy3myLIkMjNEdq+6UxP ChUUnVHEFtXNzjt7jsikPznmx7hVOXfsKAdJwPZ6FOo0qSazvkjKuNPi7M8Nm99yODRW Z5bWbfaKFFbhf1A1RA/2e8GZf6s/yf/9zOQJVJOZ+Mzz+5AvvwUM0YWa2TKPywmK41+Y F54KiJAfxv4NbS8kmI21Vtqb3QkZ7FdfC4WeJi8qQjPXecJ8zP0HPPXfbZgUy2M77BBv pVTw== X-Gm-Message-State: APt69E3wNkYMPf4AG4gddLIRmuk01KiqrNkSvCFYvdFK8bWVJPA7IESk c1e7tiwkmROpDsn9TNscoq6myIeY X-Google-Smtp-Source: ADUXVKIi2xYH9Wxlo5phB6xWe2hKfBi2w50ZtL8UbPFGUGt7iWv14aoYzqFMn1e8EVI23mpUEykUfA== X-Received: by 2002:adf:af0a:: with SMTP id z10-v6mr273781wrc.72.1528348026828; Wed, 06 Jun 2018 22:07:06 -0700 (PDT) From: Michael Zimmermann To: edk2-devel@lists.01.org Date: Thu, 7 Jun 2018 07:07:04 +0200 Message-Id: <20180607050704.9531-1-sigmaepsilon92@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [edk2] [PATCH] ArmPkg/ArmDisassemblerLib: fix check for MSR instruction X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: M1cha GCC8 reported it with the following warning: ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c: In function 'Disassemb= leArmInstruction': ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c:397:30: error: bitwise comparison always evaluates to false [-Werror=3Dtautological-compare] if ((OpCode & 0x0db00000) =3D=3D 0x03200000) { This condition trys to be true for both the immediate and the register version of the MSR instruction. They get identified inside the if-block using the variable I, which contains the value of bit 25. The problem with the comparison reported by GCC is that the bitmask excludes bit 25, while the value requires it to be set to one: 0x0db00000: 0000 11011 0 11 00 00 0000 000000000000 0x03200000: 0000 00110 0 10 00 00 0000 000000000000 ^ So the solution is to just don't require that bit to be set, because it gets checked later using 'I', which results in the following value: 0x01200000: 0000 00010 0 10 00 00 0000 000000000000 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael Zimmermann Reviewed-by: Ard Biesheuvel --- ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c b/ArmPkg/L= ibrary/ArmDisassemblerLib/ArmDisassembler.c index 29d9414a78b3..b449a5d3cd83 100644 --- a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c +++ b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c @@ -394,7 +394,7 @@ DisassembleArmInstruction ( } =20 =20 - if ((OpCode & 0x0db00000) =3D=3D 0x03200000) { + if ((OpCode & 0x0db00000) =3D=3D 0x01200000) { // A4.1.38 MSR{} CPSR_, # MSR{} CPSR_, if (I) { // MSR{} CPSR_, # --=20 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel