[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 11/40] target/mips: Add emulation of nanoMIPS 48-
From: |
Stefan Markovic |
Subject: |
[Qemu-devel] [PATCH v3 11/40] target/mips: Add emulation of nanoMIPS 48-bit instructions |
Date: |
Thu, 19 Jul 2018 14:54:43 +0200 |
From: Yongbok Kim <address@hidden>
Add emulation of LI48, ADDIU48, ADDIUGP48, ADDIUPC48, LWPC48, and
SWPC48 instructions.
Signed-off-by: Yongbok Kim <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
Signed-off-by: Stefan Markovic <address@hidden>
Reviewed-by: Aleksandar Markovic <address@hidden>
---
target/mips/translate.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 201baf1..c47ee7d 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -16682,6 +16682,72 @@ static int decode_nanomips_32_48_opc(CPUMIPSState
*env, DisasContext *ctx)
}
break;
case NM_P48I:
+ insn = cpu_lduw_code(env, ctx->base.pc_next + 4);
+ switch ((ctx->opcode >> 16) & 0x1f) {
+ case NM_LI48:
+ if (rt != 0) {
+ tcg_gen_movi_tl(cpu_gpr[rt],
+ extract32(ctx->opcode, 0, 16) | insn << 16);
+ }
+ break;
+ case NM_ADDIU48:
+ if (rt != 0) {
+ tcg_gen_addi_tl(cpu_gpr[rt], cpu_gpr[rt],
+ extract32(ctx->opcode, 0, 16) | insn << 16);
+ tcg_gen_ext32s_tl(cpu_gpr[rt], cpu_gpr[rt]);
+ }
+ break;
+ case NM_ADDIUGP48:
+ if (rt != 0) {
+ tcg_gen_addi_tl(cpu_gpr[rt], cpu_gpr[28],
+ extract32(ctx->opcode, 0, 16) | insn << 16);
+ tcg_gen_ext32s_tl(cpu_gpr[rt], cpu_gpr[rt]);
+ }
+ break;
+ case NM_ADDIUPC48:
+ if (rt != 0) {
+ int32_t offset = extract32(ctx->opcode, 0, 16) | insn << 16;
+ target_long addr = addr_add(ctx, ctx->base.pc_next + 6,
offset);
+
+ tcg_gen_movi_tl(cpu_gpr[rt], addr);
+ tcg_gen_ext32s_tl(cpu_gpr[rt], cpu_gpr[rt]);
+ }
+ break;
+ case NM_LWPC48:
+ if (rt != 0) {
+ TCGv t0;
+ t0 = tcg_temp_new();
+
+ int32_t offset = extract32(ctx->opcode, 0, 16) | insn << 16;
+ target_long addr = addr_add(ctx, ctx->base.pc_next + 6,
offset);
+
+ tcg_gen_movi_tl(t0, addr);
+ tcg_gen_qemu_ld_tl(cpu_gpr[rt], t0, ctx->mem_idx, MO_TESL);
+ tcg_temp_free(t0);
+ }
+ break;
+ case NM_SWPC48:
+ {
+ TCGv t0, t1;
+ t0 = tcg_temp_new();
+ t1 = tcg_temp_new();
+
+ int32_t offset = extract32(ctx->opcode, 0, 16) | insn << 16;
+ target_long addr = addr_add(ctx, ctx->base.pc_next + 6,
offset);
+
+ tcg_gen_movi_tl(t0, addr);
+ gen_load_gpr(t1, rt);
+
+ tcg_gen_qemu_st_tl(t1, t0, ctx->mem_idx, MO_TEUL);
+
+ tcg_temp_free(t0);
+ tcg_temp_free(t1);
+ }
+ break;
+ default:
+ generate_exception_end(ctx, EXCP_RI);
+ break;
+ }
return 6;
case NM_P_U12:
switch ((ctx->opcode >> 12) & 0x0f) {
--
2.7.4
- [Qemu-devel] [PATCH v3 12/40] target/mips: Add emulation of nanoMIPS FP instructions, (continued)
- [Qemu-devel] [PATCH v3 12/40] target/mips: Add emulation of nanoMIPS FP instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 07/40] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 19/40] target/mips: Add emulation of nanoMIPS branch instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 24/40] target/mips: Add updating BadInstr and BadInstrP registers for nanoMIPS, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 33/40] elf: Relax MIPS' elf_check_arch() to accept EM_NANOMIPS too, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 31/40] target/mips: Fix ERET/ERETNC behavior related to ADEL exception, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 39/40] gdbstub: Add XML support for GDB for nanoMIPS, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 11/40] target/mips: Add emulation of nanoMIPS 48-bit instructions,
Stefan Markovic <=
- [Qemu-devel] [PATCH v3 15/40] target/mips: Add emulation of misc nanoMIPS instructions (pool p_lsx), Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 03/40] target/mips: Add nanoMIPS DSP ASE opcodes, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 06/40] target/mips: Add emulation of misc nanoMIPS 16-bit instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 14/40] target/mips: Add emulation of misc nanoMIPS instructions (pool32axf), Stefan Markovic, 2018/07/19