Skip to content

Commit

Permalink
hw/nios2: exit to main CPU loop only when unmasking interrupts
Browse files Browse the repository at this point in the history
Only when guest code is unmasking interrupts, terminate the excution
of translated code and exit to the main CPU loop to handle previous
pended interrupts because of the interrupts mask by guest code.

Signed-off-by: Wentong Wu <[email protected]>
Message-id: [email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
wentongwu authored and pm215 committed Jul 13, 2020
1 parent 77b3f2a commit dcef727
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hw/nios2/cpu_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ static void nios2_pic_cpu_handler(void *opaque, int irq, int level)

void nios2_check_interrupts(CPUNios2State *env)
{
if (env->irq_pending) {
if (env->irq_pending &&
(env->regs[CR_STATUS] & CR_STATUS_PIE)) {
env->irq_pending = 0;
cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD);
}
Expand Down

0 comments on commit dcef727

Please sign in to comment.