From da22a00c1083e1b3982c454f93155d142c46b0c8 Mon Sep 17 00:00:00 2001 From: Leon Alrae Date: Sun, 11 Feb 2018 17:17:46 -0500 Subject: [PATCH] target-mips: pass 0 instead of -1 as rs in microMIPS LUI instruction Using rs = -1 in gen_logic_imm() for microMIPS LUI instruction is dangerous and may bite us when implementing microMIPS R6 because in R6 AUI and LUI are distinguished by rs value. Therefore use 0 for safety. Backports commit 5e88759a52934a32502298f2c78c6dfaa144364b from qemu --- qemu/target-mips/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu/target-mips/translate.c b/qemu/target-mips/translate.c index f2f502ec..fed7eae3 100644 --- a/qemu/target-mips/translate.c +++ b/qemu/target-mips/translate.c @@ -13754,7 +13754,7 @@ static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx, target. */ break; case LUI: - gen_logic_imm(ctx, OPC_LUI, rs, -1, imm); + gen_logic_imm(ctx, OPC_LUI, rs, 0, imm); break; case SYNCI: /* Break the TB to be able to sync copied instructions