target-mips: fix semihosting for microMIPS R6
authorLeon Alrae <leon.alrae@imgtec.com>
Mon, 3 Aug 2015 12:01:19 +0000 (13:01 +0100)
committerLeon Alrae <leon.alrae@imgtec.com>
Tue, 4 Aug 2015 10:10:20 +0000 (11:10 +0100)
In semihosting mode the SDBBP 1 instructions should trigger UHI syscall,
but in QEMU this does not happen for recently added microMIPS R6.
Consequently bare metal microMIPS R6 programs supporting UHI will not run.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
target-mips/translate.c

index d1de35ad30e26fed645daaef14160cb666439f1e..e299643e04058b46d428c6feb2cf47ddc27e155f 100644 (file)
@@ -13278,10 +13278,14 @@ static void gen_pool16c_r6_insn(DisasContext *ctx)
             break;
         case R6_SDBBP16:
             /* SDBBP16 */
-            if (ctx->hflags & MIPS_HFLAG_SBRI) {
-                generate_exception(ctx, EXCP_RI);
+            if (is_uhi(extract32(ctx->opcode, 6, 4))) {
+                gen_helper_do_semihosting(cpu_env);
             } else {
-                generate_exception(ctx, EXCP_DBp);
+                if (ctx->hflags & MIPS_HFLAG_SBRI) {
+                    generate_exception(ctx, EXCP_RI);
+                } else {
+                    generate_exception(ctx, EXCP_DBp);
+                }
             }
             break;
         }