public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH EDK2 v1 0/1] ArmPkg/ArmDisassemblerLib: fix incorrect comparison
@ 2020-12-08 13:07 wenyi,xie
  2020-12-08 13:07 ` [PATCH EDK2 v1 1/1] " wenyi,xie
  0 siblings, 1 reply; 3+ messages in thread
From: wenyi,xie @ 2020-12-08 13:07 UTC (permalink / raw)
  To: devel, leif, ard.biesheuvel; +Cc: songdongkuang, xiewenyi2

Main Changes :
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, so 0x12 should to changed to 0x2.

Wenyi Xie (1):
  ArmPkg/ArmDisassemblerLib: fix incorrect comparison

 ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1.windows.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH EDK2 v1 1/1] ArmPkg/ArmDisassemblerLib: fix incorrect comparison
  2020-12-08 13:07 [PATCH EDK2 v1 0/1] ArmPkg/ArmDisassemblerLib: fix incorrect comparison wenyi,xie
@ 2020-12-08 13:07 ` wenyi,xie
  2020-12-08 13:59   ` [edk2-devel] " Leif Lindholm
  0 siblings, 1 reply; 3+ messages in thread
From: wenyi,xie @ 2020-12-08 13:07 UTC (permalink / raw)
  To: devel, leif, ard.biesheuvel; +Cc: songdongkuang, xiewenyi2

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH EDK2 v1 1/1] ArmPkg/ArmDisassemblerLib: fix incorrect comparison
  2020-12-08 13:07 ` [PATCH EDK2 v1 1/1] " wenyi,xie
@ 2020-12-08 13:59   ` Leif Lindholm
  0 siblings, 0 replies; 3+ messages in thread
From: Leif Lindholm @ 2020-12-08 13:59 UTC (permalink / raw)
  To: devel, xiewenyi2; +Cc: ard.biesheuvel, songdongkuang

On Tue, Dec 08, 2020 at 21:07:49 +0800, wenyi,xie via groups.io wrote:
> 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.

Whoops[tm].

> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>

Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Pushed as 8e4cb8fbceb8.

Thanks!

> ---
>  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
> 
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-08 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-08 13:07 [PATCH EDK2 v1 0/1] ArmPkg/ArmDisassemblerLib: fix incorrect comparison wenyi,xie
2020-12-08 13:07 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2020-12-08 13:59   ` [edk2-devel] " Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox