public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "wenyi,xie" <xiewenyi2@huawei.com>
To: <devel@edk2.groups.io>, <leif@nuviainc.com>, <ard.biesheuvel@arm.com>
Cc: <songdongkuang@huawei.com>, <xiewenyi2@huawei.com>
Subject: [PATCH EDK2 v1 1/1] ArmPkg/ArmDisassemblerLib: fix incorrect comparison
Date: Tue, 8 Dec 2020 21:07:49 +0800	[thread overview]
Message-ID: <1607432869-13641-2-git-send-email-xiewenyi2@huawei.com> (raw)
In-Reply-To: <1607432869-13641-1-git-send-email-xiewenyi2@huawei.com>

As shift = (OpCode >> 5) & 0x3, shift will never be larger than 0x3,
so the comparison between shift and 0x12 will always be false. The right
shift type of ASR is 0x2.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c
index b4f0f8dbbfc9..d206cf4ea908 100644
--- a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c
+++ b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c
@@ -240,7 +240,7 @@ DisassembleArmInstruction (
           if (shift_imm == 0) {
             shift_imm = 32;
           }
-        } else if (shift == 0x12) {
+        } else if (shift == 0x2) {
           Type = "ASR";
         } else if (shift_imm == 0) {
           AsciiSPrint (&Buf[Index], Size - Index, "[%a, #%a%a, %a, RRX]%a", gReg[Rn], SIGN (U), gReg[Rm], WRITE (W));
@@ -270,7 +270,7 @@ DisassembleArmInstruction (
           if (shift_imm == 0) {
             shift_imm = 32;
           }
-        } else if (shift == 0x12) {
+        } else if (shift == 0x2) {
           Type = "ASR";
         } else if (shift_imm == 0) {
           AsciiSPrint (&Buf[Index], Size - Index, "[%a], #%a%a, %a, RRX", gReg[Rn], SIGN (U), gReg[Rm]);
-- 
2.20.1.windows.1


  reply	other threads:[~2020-12-08 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 13:07 [PATCH EDK2 v1 0/1] ArmPkg/ArmDisassemblerLib: fix incorrect comparison wenyi,xie
2020-12-08 13:07 ` wenyi,xie [this message]
2020-12-08 13:59   ` [edk2-devel] [PATCH EDK2 v1 1/1] " Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1607432869-13641-2-git-send-email-xiewenyi2@huawei.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox