[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v9 39/84] target/mips: Add emulation of nanoMIPS
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v9 39/84] target/mips: Add emulation of nanoMIPS 32-bit branch instructions |
Date: |
Thu, 16 Aug 2018 09:31:52 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 08/16/2018 07:57 AM, Aleksandar Markovic wrote:
> + } else {
> + /* Conditional compact branch */
> + TCGLabel *fs = gen_new_label();
> + save_cpu_state(ctx, 0);
I will note that save_cpu_state(ctx, 0) is concerned about updating the BMASK
bits for branch delay slots, which nanomips does not have. The function could
probably usefully be renamed so that's clearer.
> + /* unconditional branch to register */
> + tcg_gen_mov_tl(cpu_PC, btarget);
> + if (ctx->base.singlestep_enabled) {
> + save_cpu_state(ctx, 0);
Likewise.
> + } else {
> + /* Conditional compact branch */
> + TCGLabel *fs = gen_new_label();
> + save_cpu_state(ctx, 0);
Likewise.
> case NM_MOVE_BALC:
> + {
> + TCGv t0 = tcg_temp_new();
> + int32_t s = sextract32(ctx->opcode, 0, 1) << 21 |
> + extract32(ctx->opcode, 1, 20) << 1;
> + rd = (extract32(ctx->opcode, 24, 1)) == 0 ? 4 : 5;
> + rt = decode_gpr_gpr4_zero(extract32(ctx->opcode, 25, 1) << 3 |
> + extract32(ctx->opcode, 21, 3));
> + gen_load_gpr(t0, rt);
> + tcg_gen_mov_tl(cpu_gpr[rd], t0);
> + gen_compute_branch(ctx, OPC_BGEZAL, 4, 0, 0, s, 0);
> + tcg_temp_free(t0);
> + }
> break;
> case NM_P_BAL:
> + {
> + int32_t s = sextract32(ctx->opcode, 0, 1) << 25 |
> + extract32(ctx->opcode, 1, 24) << 1;
> +
> + if ((extract32(ctx->opcode, 25, 1)) == 0) {
> + /* BC */
> + gen_compute_branch(ctx, OPC_BEQ, 4, 0, 0, s, 0);
> + } else {
> + /* BALC */
> + gen_compute_branch(ctx, OPC_BGEZAL, 4, 0, 0, s, 0);
> + }
> + }
> break;
> case NM_P_J:
> + switch (extract32(ctx->opcode, 12, 4)) {
> + case NM_JALRC:
> + case NM_JALRC_HB:
> + gen_compute_branch(ctx, OPC_JALR, 4, rs, rt, 0, 0);
> + break;
All of these branches need to be using the new functions that you just added.
There are even more incorrect uses to follow.
r~
- [Qemu-devel] [PATCH v9 31/84] target/mips: Add emulation of nanoMIPS FP instructions, (continued)
- [Qemu-devel] [PATCH v9 31/84] target/mips: Add emulation of nanoMIPS FP instructions, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 51/84] target/mips: Adjust exception_resume_pc() for nanoMIPS, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 30/84] target/mips: Add emulation of nanoMIPS 48-bit instructions, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 27/84] target/mips: Add emulation of nanoMIPS 16-bit save and restore instructions, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 18/84] target/mips: Add nanoMIPS DSP ASE opcodes, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 34/84] target/mips: Add emulation of misc nanoMIPS instructions (p_lsx), Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 33/84] target/mips: Add emulation of misc nanoMIPS instructions (pool32axf), Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 36/84] target/mips: Implement emulation of nanoMIPS EXTW instruction, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 39/84] target/mips: Add emulation of nanoMIPS 32-bit branch instructions, Aleksandar Markovic, 2018/08/16
- Re: [Qemu-devel] [PATCH v9 39/84] target/mips: Add emulation of nanoMIPS 32-bit branch instructions,
Richard Henderson <=
- [Qemu-devel] [PATCH v9 44/84] target/mips: Add emulation of DSP ASE for nanoMIPS - part 3, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 42/84] target/mips: Add emulation of DSP ASE for nanoMIPS - part 1, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 46/84] target/mips: Add emulation of DSP ASE for nanoMIPS - part 5, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 41/84] target/mips: Implement MT ASE support for nanoMIPS, Aleksandar Markovic, 2018/08/16
- [Qemu-devel] [PATCH v9 43/84] target/mips: Add emulation of DSP ASE for nanoMIPS - part 2, Aleksandar Markovic, 2018/08/16