All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] disas/riscv: Fix incorrect disassembly for `imm20` operand.
@ 2020-07-07 10:09 lazyparser
  2020-07-07 15:15 ` Alistair Francis
  0 siblings, 1 reply; 6+ messages in thread
From: lazyparser @ 2020-07-07 10:09 UTC (permalink / raw)
  To: qemu-riscv; +Cc: palmer, Alistair.Francis, Wei Wu

From: Wei Wu <lazyparser@gmail.com>

`imm20` operand type is used in LUI/AUIPC and other instructions.
The value should not be left shifted 12bits for disassembly output.

Signed-off-by: Wei Wu <lazyparser@gmail.com>
---
 disas/riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disas/riscv.c b/disas/riscv.c
index 278d9be924..a2b6472bd8 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -2083,7 +2083,7 @@ static int32_t operand_imm12(rv_inst inst)
 
 static int32_t operand_imm20(rv_inst inst)
 {
-    return (((int64_t)inst << 32) >> 44) << 12;
+    return ((int64_t)inst << 32) >> 44;
 }
 
 static int32_t operand_jimm20(rv_inst inst)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] disas/riscv: Fix incorrect disassembly for `imm20` operand.
@ 2020-07-07 15:43 Wei Wu
  2020-07-10 18:30 ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Wu @ 2020-07-07 15:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alistair.Francis, palmer, Wei Wu

`imm20` operand type is used in LUI/AUIPC and other instructions.
The value should not be left shifted 12bits for disassembly output.

Signed-off-by: Wei Wu <lazyparser@gmail.com>
---
 disas/riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disas/riscv.c b/disas/riscv.c
index 278d9be924..a2b6472bd8 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -2083,7 +2083,7 @@ static int32_t operand_imm12(rv_inst inst)
 
 static int32_t operand_imm20(rv_inst inst)
 {
-    return (((int64_t)inst << 32) >> 44) << 12;
+    return ((int64_t)inst << 32) >> 44;
 }
 
 static int32_t operand_jimm20(rv_inst inst)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] disas/riscv: Fix incorrect disassembly for `imm20` operand.
@ 2020-07-07  8:20 Wei Wu (吴伟)
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Wu (吴伟) @ 2020-07-07  8:20 UTC (permalink / raw)
  To: qemu-riscv; +Cc: Palmer Dabbelt, Alistair Francis

[-- Attachment #1: Type: text/plain, Size: 635 bytes --]

`imm20` operand type is used in LUI/AUIPC and other instructions.
The value should not be left shifted 12bits for disassembly output.

Signed-off-by: Wei Wu <lazyparser@gmail.com>
---
 disas/riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disas/riscv.c b/disas/riscv.c
index 278d9be924..a2b6472bd8 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -2083,7 +2083,7 @@ static int32_t operand_imm12(rv_inst inst)

 static int32_t operand_imm20(rv_inst inst)
 {
-    return (((int64_t)inst << 32) >> 44) << 12;
+    return ((int64_t)inst << 32) >> 44;
 }

 static int32_t operand_jimm20(rv_inst inst)
--
2.17.1

[-- Attachment #2: Type: text/html, Size: 819 bytes --]

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

end of thread, other threads:[~2020-07-10 18:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-07 10:09 [PATCH] disas/riscv: Fix incorrect disassembly for `imm20` operand lazyparser
2020-07-07 15:15 ` Alistair Francis
2020-07-07 15:47   ` Wei Wu (吴伟)
  -- strict thread matches above, loose matches on Subject: below --
2020-07-07 15:43 Wei Wu
2020-07-10 18:30 ` Richard Henderson
2020-07-07  8:20 Wei Wu (吴伟)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.