qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] target/mips: fix JALS32/J32 instruction handling for mic


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 1/3] target/mips: fix JALS32/J32 instruction handling for microMIPS
Date: Wed, 15 Feb 2023 21:50:24 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.2

On 15/2/23 21:21, Richard Henderson wrote:
On 2/14/23 22:47, Marcin Nowakowski wrote:
@@ -4860,6 +4860,7 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc,
      target_ulong btgt = -1;
      int blink = 0;
      int bcond_compute = 0;
+    int jal_mask = 0;

Better to limit the scope of the variable to the block below.

@@ -4917,6 +4918,11 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc,
          break;
      case OPC_J:
      case OPC_JAL:
+        /* Jump to immediate */
+        jal_mask = ctx->hflags & MIPS_HFLAG_M16 ? 0xF8000000 : 0xF0000000;
+        btgt = ((ctx->base.pc_next + insn_bytes) & jal_mask) |
+            (uint32_t)offset;

Ideally we wouldn't have one huge helper function, and could pass down the mask from the translator.  But that's on-going cleanup.

Yes, this is the approach taken in decodetree conversion.

I hope to rebase / respin incorporating Jiaxun patches some day...

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]