summaryrefslogtreecommitdiffstats
path: root/target/mips/translate.h
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2020-11-29 19:13:28 +0100
committerPhilippe Mathieu-Daudé2021-01-14 17:13:53 +0100
commit46c9e2b3dddc63bc85e07e3ad33fceb9d300be67 (patch)
tree47cf670816b9198d569349e829f3603f18f97a74 /target/mips/translate.h
parenttarget/mips/translate: Extract DisasContext structure (diff)
downloadqemu-46c9e2b3dddc63bc85e07e3ad33fceb9d300be67.tar.gz
qemu-46c9e2b3dddc63bc85e07e3ad33fceb9d300be67.tar.xz
qemu-46c9e2b3dddc63bc85e07e3ad33fceb9d300be67.zip
target/mips/translate: Add declarations for generic code
Some CPU translation functions / registers / macros and definitions can be used by ISA / ASE / extensions out of the big translate.c file. Declare them in "translate.h". Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20201207235539.4070364-3-f4bug@amsat.org>
Diffstat (limited to 'target/mips/translate.h')
-rw-r--r--target/mips/translate.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/target/mips/translate.h b/target/mips/translate.h
index fcda1a9900..3d640912f1 100644
--- a/target/mips/translate.h
+++ b/target/mips/translate.h
@@ -10,6 +10,8 @@
#include "exec/translator.h"
+#define MIPS_DEBUG_DISAS 0
+
typedef struct DisasContext {
DisasContextBase base;
target_ulong saved_pc;
@@ -47,4 +49,45 @@ typedef struct DisasContext {
int gi;
} DisasContext;
+/* MIPS major opcodes */
+#define MASK_OP_MAJOR(op) (op & (0x3F << 26))
+
+void generate_exception(DisasContext *ctx, int excp);
+void generate_exception_err(DisasContext *ctx, int excp, int err);
+void generate_exception_end(DisasContext *ctx, int excp);
+
+void check_insn(DisasContext *ctx, uint64_t flags);
+#ifdef TARGET_MIPS64
+void check_mips_64(DisasContext *ctx);
+#endif
+
+void gen_base_offset_addr(DisasContext *ctx, TCGv addr, int base, int offset);
+void gen_move_low32(TCGv ret, TCGv_i64 arg);
+void gen_move_high32(TCGv ret, TCGv_i64 arg);
+void gen_load_gpr(TCGv t, int reg);
+void gen_store_gpr(TCGv t, int reg);
+
+void gen_op_addr_add(DisasContext *ctx, TCGv ret, TCGv arg0, TCGv arg1);
+
+extern TCGv cpu_gpr[32], cpu_PC;
+extern TCGv bcond;
+
+#define LOG_DISAS(...) \
+ do { \
+ if (MIPS_DEBUG_DISAS) { \
+ qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
+#define MIPS_INVAL(op) \
+ do { \
+ if (MIPS_DEBUG_DISAS) { \
+ qemu_log_mask(CPU_LOG_TB_IN_ASM, \
+ TARGET_FMT_lx ": %08x Invalid %s %03x %03x %03x\n", \
+ ctx->base.pc_next, ctx->opcode, op, \
+ ctx->opcode >> 26, ctx->opcode & 0x3F, \
+ ((ctx->opcode >> 16) & 0x1F)); \
+ } \
+ } while (0)
+
#endif