Skip to content

Commit 77b3f2a

Browse files
wentongwupm215
authored andcommitted
target/nios2: Use gen_io_start around wrctl instruction
wrctl instruction on nios2 target will cause checking cpu interrupt but tcg_handle_interrupt() will call cpu_abort() if the CPU gets an interrupt while it's not in 'can do IO' state, so add gen_io_start around wrctl instruction. Also at the same time, end the onging TB with DISAS_UPDATE. Signed-off-by: Wentong Wu <[email protected]> Message-id: [email protected] Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Peter Maydell <[email protected]>
1 parent c769453 commit 77b3f2a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

target/nios2/translate.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "exec/cpu_ldst.h"
3333
#include "exec/translator.h"
3434
#include "qemu/qemu-print.h"
35+
#include "exec/gen-icount.h"
3536

3637
/* is_jmp field values */
3738
#define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */
@@ -518,7 +519,11 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags)
518519
/* If interrupts were enabled using WRCTL, trigger them. */
519520
#if !defined(CONFIG_USER_ONLY)
520521
if ((instr.imm5 + CR_BASE) == CR_STATUS) {
522+
if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
523+
gen_io_start();
524+
}
521525
gen_helper_check_interrupts(dc->cpu_env);
526+
dc->is_jmp = DISAS_UPDATE;
522527
}
523528
#endif
524529
}

0 commit comments

Comments
 (0)