qemu/disas
Christoph Müllner 36df75a0a9 riscv/disas: Fix disas output of upper immediates
The GNU assembler produces the following output for instructions
with upper immediates:
    00002597                auipc   a1,0x2
    000024b7                lui     s1,0x2
    6409                    lui     s0,0x2 # c.lui

The immediate operands of upper immediates are not shifted.

However, the QEMU disassembler prints them shifted:
    00002597          auipc                   a1,8192
    000024b7          lui                     s1,8192
    6409              lui                     s0,8192 # c.lui

The current implementation extracts the immediate bits and shifts the by 12,
so the internal representation of the immediate is the actual immediate.
However, the immediates are later printed using rv_fmt_rd_imm or
rv_fmt_rd_offset, which don't undo the shift.

Let's fix this by using specific output formats for instructions
with upper immediates, that take care of the shift.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230711075051.1531007-1-christoph.muellner@vrull.eu>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2023-07-19 14:30:04 +10:00
..
alpha.c disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h 2019-04-18 22:18:59 +02:00
capstone.c disas: use result of ->read_memory_func 2022-10-06 11:53:40 +01:00
cris.c cris: do not leak struct cris_disasm_data 2019-10-04 18:49:17 +02:00
disas-internal.h disas: Move softmmu specific code to separate file 2023-05-11 09:49:55 +01:00
disas-mon.c disas: Move softmmu specific code to separate file 2023-05-11 09:49:55 +01:00
disas.c disas: Move disas.c into the target-independent source set 2023-05-11 09:51:07 +01:00
hexagon.c Hexagon (disas/hexagon.c) fix memory leak for early exit cases 2021-08-12 09:06:05 -05:00
hppa.c disas/: fix some comment spelling errors 2020-09-17 20:40:08 +02:00
m68k.c disas/: fix some comment spelling errors 2020-09-17 20:40:08 +02:00
meson.build disas/riscv: Add support for XThead* instructions 2023-07-10 22:29:14 +10:00
microblaze.c disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h 2019-04-18 22:18:59 +02:00
mips.c disas/mips: Fix branch displacement for BEQZC and BNEZC 2022-10-31 11:32:07 +01:00
nanomips.c disas/nanomips: Tidy read for 48-bit opcodes 2022-11-08 01:04:25 +01:00
nios2.c disas/nios2: Simplify endianess conversion 2021-10-22 18:07:30 +02:00
riscv-xthead.c disas/riscv: Add support for XThead* instructions 2023-07-10 22:29:14 +10:00
riscv-xthead.h disas/riscv: Add support for XThead* instructions 2023-07-10 22:29:14 +10:00
riscv-xventana.c disas/riscv: Add support for XVentanaCondOps 2023-07-10 22:29:14 +10:00
riscv-xventana.h disas/riscv: Add support for XVentanaCondOps 2023-07-10 22:29:14 +10:00
riscv.c riscv/disas: Fix disas output of upper immediates 2023-07-19 14:30:04 +10:00
riscv.h riscv/disas: Fix disas output of upper immediates 2023-07-19 14:30:04 +10:00
sh4.c disas/sh4: Add missing fallthrough annotations 2020-07-13 11:40:52 +02:00
sparc.c disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h 2019-04-18 22:18:59 +02:00
xtensa.c disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h 2019-04-18 22:18:59 +02:00