Skip to contentSkip to conversation

target-mips: fix semihosting for microMIPS R6

PATCH In review Leon Alrae 2 participants 2 messages Aug 3, 2015

lore
Share & tools
lore

Leon Alrae

author
#0 lore raw

PATCH 1/1 target-mips: fix semihosting for microMIPS R6

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.

---
 target-mips/translate.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
target-mips/translate.c +7 -3
index d1de35a..e299643 100644
@@ -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;
         }
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Leon Alrae

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.

---
 target-mips/translate.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net