@@ -222,6 +222,8 @@ bool decode_ase_mxu(DisasContext *ctx, uint32_t insn);
bool decode_64bit_enabled(DisasContext *ctx);
/* decodetree generated */
+bool decode_isa_micromips16(DisasContext *ctx, uint16_t insn);
+bool decode_isa_micromips32(DisasContext *ctx, uint32_t insn);
bool decode_isa_rel6(DisasContext *ctx, uint32_t insn);
bool decode_ase_msa(DisasContext *ctx, uint32_t insn);
bool decode_ext_txx9(DisasContext *ctx, uint32_t insn);
new file mode 100644
@@ -0,0 +1,9 @@
+# microMIPS32 16-bit instruction set extensions
+#
+# Copyright (C) 2021 Philippe Mathieu-Daudé
+#
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# Reference: MIPS Architecture for Programmers, Volume II-B
+# microMIPS32 Instruction Set
+# (Document Number: MD00582)
new file mode 100644
@@ -0,0 +1,9 @@
+# microMIPS32 32-bit instruction set extensions
+#
+# Copyright (C) 2021 Philippe Mathieu-Daudé
+#
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# Reference: MIPS Architecture for Programmers, Volume II-B
+# microMIPS32 Instruction Set
+# (Document Number: MD00582)
new file mode 100644
@@ -0,0 +1,14 @@
+/*
+ * MIPS emulation for QEMU - microMIPS translation routines
+ *
+ * Copyright (c) 2021 Philippe Mathieu-Daudé <f4bug@amsat.org>
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "translate.h"
+
+/* Include the auto-generated decoders. */
+#include "decode-micromips16.c.inc"
+#include "decode-micromips32.c.inc"
@@ -3000,6 +3000,9 @@ static int decode_isa_micromips(CPUMIPSState *env, DisasContext *ctx)
gen_reserved_instruction(ctx);
return 2;
}
+ if (decode_isa_micromips32(ctx, ctx->opcode)) {
+ return 4;
+ }
break;
case 1:
/* POOL16A, POOL16B, POOL16C, LWGP16, POOL16F */
@@ -3011,6 +3014,9 @@ static int decode_isa_micromips(CPUMIPSState *env, DisasContext *ctx)
gen_reserved_instruction(ctx);
return 2;
}
+ if (decode_isa_micromips16(ctx, ctx->opcode)) {
+ return 2;
+ }
break;
}
}
@@ -1,4 +1,6 @@
gen = [
+ decodetree.process('micromips16.decode', extra_args: ['--decode=decode_isa_micromips16', '--insnwidth=16']),
+ decodetree.process('micromips32.decode', extra_args: ['--decode=decode_isa_micromips32']),
decodetree.process('rel6.decode', extra_args: ['--decode=decode_isa_rel6']),
decodetree.process('msa.decode', extra_args: '--decode=decode_ase_msa'),
decodetree.process('tx79.decode', extra_args: '--static-decode=decode_tx79'),
@@ -16,6 +18,7 @@ mips_ss.add(files(
'fpu_helper.c',
'ldst_helper.c',
'lmmi_helper.c',
+ 'micromips_translate.c',
'msa_helper.c',
'msa_translate.c',
'op_helper.c',