From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::241; helo=mail-it0-x241.google.com; envelope-from=sigmaepsilon92@gmail.com; receiver=edk2-devel@lists.01.org Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (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 2862B210F202F for ; Thu, 7 Jun 2018 10:04:08 -0700 (PDT) Received: by mail-it0-x241.google.com with SMTP id l6-v6so13566571iti.2 for ; Thu, 07 Jun 2018 10:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fikbR5ZPCy/Lflt+qGt/PBcMF0mMQAIfuVPYtmEucMQ=; b=NZhlmNiVHJ2lAKd2eMe7dA50diWrmpFmYPsBWFmbBdBFIExm4mVa+EorAHpKw/0GbA YZdwUx6fxLqZd7ZaFpTp1UZLHzE+YPF4vBDhcaX9lFRDvKMxfknu/Sj7PCBm4Z4tMDNZ 1RE1Dgd8HJyvUz2OWqF51OrjzoS8g9vxKHhaA0mL97jmOPbexOHcfUw7w+Ik4w4BWmOX PRKnNrpaPnpH23UWY9XGIZ0R7GHjDsqTJV1Ts2u2Ni5gfgL32cwRUVuqIejuQJyG6p/R l/9gtIXLzHmNHf9maZ+Y7zZ2MDA1COudMPgudtQ7YrKmz8V8F/wOtWFmaDr4sSwih7wk lnsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fikbR5ZPCy/Lflt+qGt/PBcMF0mMQAIfuVPYtmEucMQ=; b=PGdM0v7DQS+KsK/VgYmdDVThcFb1SZewIug1Yo1ygYiv/+odcmv96m+8HYgYgaIPdQ IOGcHHar+mBlcKmNFv2ppV8Sq5/7ZOJmsNAKFt6nz906cMJooitNTR4DLPsMZGV6o9sW 321sneqNFgrIa7hLzmR32oVFxUfSDMSqWyHaYUaojUSPDYG9taPF2N1eFWKOEZnR+AWn yPw4FvXwOqpxvv41Y0uOd60xF8RM0Fuew7FdxBB//oerUOu4OH+MiPBStT7Ur0Xyra3e nsEfDDbicH7y4/bV2Oxn3r4vuu8GzH+Xx+BQMRdPznLs2OoLLTfa2LOXjCAV04vm3GRy JVQA== X-Gm-Message-State: APt69E1HgP8/0AAaaAUSrb90Mhnc4NXRjgmO/3/O2P5PGNUPC6nkllPd CtijbSLoeB/4bnb+Nx6nTJS+plfAuaFbxvQEkoMXUg== X-Google-Smtp-Source: ADUXVKLFz5diSsaZJdV1l8VzkwRcC+3+yf13eOPzl+F6dcu647ahSE9mSqvZpp4Yg8T39FqCYIgdJiI3jFdnmTt/Kis= X-Received: by 2002:a24:798f:: with SMTP id z137-v6mr2580679itc.19.1528391047289; Thu, 07 Jun 2018 10:04:07 -0700 (PDT) MIME-Version: 1.0 References: <20180607050704.9531-1-sigmaepsilon92@gmail.com> In-Reply-To: From: Michael Zimmermann Date: Thu, 7 Jun 2018 19:03:54 +0200 Message-ID: To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [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: , X-List-Received-Date: Thu, 07 Jun 2018 17:04:08 -0000 Content-Type: text/plain; charset="UTF-8" yes I'll do that next time. Thanks for the hint. Thanks Michael On Thu, Jun 7, 2018 at 9:10 AM Ard Biesheuvel wrote: > > On 7 June 2018 at 07:08, Michael Zimmermann wrote: > > CC the arm maintainers > > On Thu, Jun 7, 2018 at 7:07 AM Michael Zimmermann > > wrote: > >> > >> From: M1cha > >> > > Could you please use the same 'from' name+address as in the signoff? > That saves me the hassle of fixing it up manually. > > >> GCC8 reported it with the following warning: > >> ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c: In function 'DisassembleArmInstruction': > >> ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c:397:30: error: bitwise > >> comparison always evaluates to false [-Werror=tautological-compare] > >> if ((OpCode & 0x0db00000) == 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 > >> --- > >> ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c > >> index 29d9414a78b3..b449a5d3cd83 100644 > >> --- a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c > >> +++ b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c > >> @@ -394,7 +394,7 @@ DisassembleArmInstruction ( > >> } > >> > >> > >> - if ((OpCode & 0x0db00000) == 0x03200000) { > >> + if ((OpCode & 0x0db00000) == 0x01200000) { > >> // A4.1.38 MSR{} CPSR_, # MSR{} CPSR_, > >> if (I) { > >> // MSR{} CPSR_, # > > Reviewed-by: Ard Biesheuvel > > Pushed as b20085454e91bb1ded87009722c9994b4684472c > > Thanks,