From 4892c68f17dc23800e7afc03e9a44e2374232857 Mon Sep 17 00:00:00 2001 From: xctan Date: Tue, 28 Jan 2025 15:07:42 +0800 Subject: [PATCH] [RV64_DYNAREC] Fixed lui/auipc immediate in the printer (#2299) --- src/dynarec/rv64/rv64_printer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dynarec/rv64/rv64_printer.c b/src/dynarec/rv64/rv64_printer.c index a98a0cbb34..f20d1026a2 100644 --- a/src/dynarec/rv64/rv64_printer.c +++ b/src/dynarec/rv64/rv64_printer.c @@ -1217,7 +1217,7 @@ const char* rv64_print(uint32_t opcode, uintptr_t addr) if ((opcode & 0x7f) == 0x17) { a.rd = FX(opcode, 11, 7); a.imm = FX(opcode, 31, 12); - snprintf(buff, sizeof(buff), "%-15s %s, 0x%x(%d)", "AUIPC", gpr[a.rd], SIGN_EXTEND(a.imm, 20), SIGN_EXTEND(a.imm, 20)); + snprintf(buff, sizeof(buff), "%-15s %s, 0x%x(%d)", "AUIPC", gpr[a.rd], a.imm << 12, a.imm << 12); return buff; } @@ -2233,7 +2233,7 @@ const char* rv64_print(uint32_t opcode, uintptr_t addr) if ((opcode & 0x7f) == 0x37) { a.rd = FX(opcode, 11, 7); a.imm = FX(opcode, 31, 12); - snprintf(buff, sizeof(buff), "%-15s %s, 0x%x(%d)", "LUI", gpr[a.rd], SIGN_EXTEND(a.imm, 20), SIGN_EXTEND(a.imm, 20)); + snprintf(buff, sizeof(buff), "%-15s %s, 0x%x(%d)", "LUI", gpr[a.rd], a.imm << 12, a.imm << 12); return buff; }