[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/19] target/microblaze: Handle DISAS_EXIT_NEXT in delay slot
From: |
Richard Henderson |
Subject: |
[PULL 08/19] target/microblaze: Handle DISAS_EXIT_NEXT in delay slot |
Date: |
Mon, 7 Sep 2020 10:50:51 -0700 |
It is legal to put an mts instruction into a delay slot.
We should continue to return to the main loop in that
case so that we recognize any pending interrupts.
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/translate.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 6bf299a826..608d413c83 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -1696,6 +1696,10 @@ static void mb_tr_translate_insn(DisasContextBase *dcb,
CPUState *cs)
dc->base.pc_next += 4;
if (dc->jmp_cond != TCG_COND_NEVER && !(dc->tb_flags & D_FLAG)) {
+ /*
+ * Finish any return-from branch.
+ * TODO: Diagnose rtXd in delay slot of rtYd earlier.
+ */
if (dc->tb_flags & DRTI_FLAG) {
do_rti(dc);
} else if (dc->tb_flags & DRTB_FLAG) {
@@ -1703,7 +1707,35 @@ static void mb_tr_translate_insn(DisasContextBase *dcb,
CPUState *cs)
} else if (dc->tb_flags & DRTE_FLAG) {
do_rte(dc);
}
- dc->base.is_jmp = DISAS_JUMP;
+
+ /* Complete the branch, ending the TB. */
+ switch (dc->base.is_jmp) {
+ case DISAS_NORETURN:
+ /*
+ * E.g. illegal insn in a delay slot. We've already exited
+ * and will handle D_FLAG in mb_cpu_do_interrupt.
+ */
+ break;
+ case DISAS_EXIT:
+ /*
+ * TODO: diagnose brk/brki in delay slot earlier.
+ * This would then fold into the illegal insn case above.
+ */
+ break;
+ case DISAS_NEXT:
+ /* Normal insn a delay slot. */
+ dc->base.is_jmp = DISAS_JUMP;
+ break;
+ case DISAS_EXIT_NEXT:
+ /*
+ * E.g. mts insn in a delay slot. Continue with btarget,
+ * but still return to the main loop.
+ */
+ dc->base.is_jmp = DISAS_EXIT_JUMP;
+ break;
+ default:
+ g_assert_not_reached();
+ }
}
}
--
2.25.1
- [PULL 00/19] target/microblaze patch queue, Richard Henderson, 2020/09/07
- [PATCH] hw/hyperv: Fix 32-bit build error for vmbus., Richard Henderson, 2020/09/07
- [PULL 01/19] target/microblaze: Collected fixes for env->iflags, Richard Henderson, 2020/09/07
- [PULL 02/19] target/microblaze: Renumber D_FLAG, Richard Henderson, 2020/09/07
- [PULL 04/19] target/microblaze: Rename mmu structs, Richard Henderson, 2020/09/07
- [PULL 05/19] target/microblaze: Rename DISAS_UPDATE to DISAS_EXIT, Richard Henderson, 2020/09/07
- [PULL 03/19] target/microblaze: Cleanup mb_cpu_do_interrupt, Richard Henderson, 2020/09/07
- [PULL 06/19] target/microblaze: Introduce DISAS_EXIT_NEXT, DISAS_EXIT_JUMP, Richard Henderson, 2020/09/07
- [PULL 07/19] target/microblaze: Replace cpustate_changed with DISAS_EXIT_NEXT, Richard Henderson, 2020/09/07
- [PULL 08/19] target/microblaze: Handle DISAS_EXIT_NEXT in delay slot,
Richard Henderson <=
- [PULL 09/19] target/microblaze: Force rtid, rted, rtbd to exit, Richard Henderson, 2020/09/07
- [PULL 10/19] target/microblaze: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2020/09/07
- [PULL 11/19] target/microblaze: Diagnose invalid insns in delay slots, Richard Henderson, 2020/09/07
- [PULL 12/19] target/microblaze: Split out MicroBlazeCPUConfig, Richard Henderson, 2020/09/07
- [PULL 15/19] target/microblaze: Treat pvr_regs as constant, Richard Henderson, 2020/09/07
- [PULL 14/19] target/microblaze: Move pvr regs to MicroBlazeCPUConfig, Richard Henderson, 2020/09/07
- [PULL 16/19] target/microblaze: Move mmu parameters to MicroBlazeCPUConfig, Richard Henderson, 2020/09/07
- [PULL 17/19] target/microblaze: Fill in VMStateDescription for cpu, Richard Henderson, 2020/09/07
- [PULL 13/19] target/microblaze: Reorg MicroBlazeCPUConfig to minimize holes, Richard Henderson, 2020/09/07
- [PULL 18/19] target/microblaze: Put MicroBlazeCPUConfig into DisasContext, Richard Henderson, 2020/09/07