Skip to content

Commit 9b2cc10

Browse files
duynguyenxastephanosio
authored andcommitted
target/rx: Update flow of interrupt execution for target rx
do_interrupt function is call directly from CPU exception so we need to add condition to check for CPU exception in case of hardware interrupt is preempted to prevent unexpect behavior Signed-off-by: Duy Nguyen <[email protected]>
1 parent 4e7f1fa commit 9b2cc10

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

target/rx/helper.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ void rx_cpu_do_interrupt(CPUState *cs)
4848
uint32_t save_psw;
4949

5050
env->in_sleep = 0;
51-
5251
if (env->psw_u) {
5352
env->usp = env->regs[0];
5453
} else {
5554
env->isp = env->regs[0];
5655
}
5756
save_psw = rx_cpu_pack_psw(env);
5857
env->psw_pm = env->psw_i = env->psw_u = 0;
58+
int32_t vec = cs->exception_index;
5959

60-
if (do_irq) {
60+
if (do_irq && vec < 0) {
6161
if (do_irq & CPU_INTERRUPT_FIR) {
6262
env->bpc = env->pc;
6363
env->bpsw = save_psw;
@@ -79,7 +79,6 @@ void rx_cpu_do_interrupt(CPUState *cs)
7979
"interrupt 0x%02x raised\n", env->ack_irq);
8080
}
8181
} else {
82-
uint32_t vec = cs->exception_index;
8382
const char *expname = "unknown exception";
8483

8584
env->isp -= 4;

0 commit comments

Comments
 (0)