From 5bc1f43dbedbb3d38fafaff0f60868377756e02f Mon Sep 17 00:00:00 2001 From: Max Schwarz Date: Mon, 26 Oct 2015 12:15:30 +0100 Subject: [PATCH] sim_interrupts: fix FIFO move operation The variable 'mini' is a FIFO index, not a direct index into the buffer! Add the current read pointer to fix the operation. Fixes a regression introduced in 599733f261f94317489c2cc8751fb84fd604e6fa. --- simavr/sim/sim_interrupts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simavr/sim/sim_interrupts.c b/simavr/sim/sim_interrupts.c index 0022795..651af3e 100644 --- a/simavr/sim/sim_interrupts.c +++ b/simavr/sim/sim_interrupts.c @@ -248,7 +248,7 @@ avr_service_interrupts( // now move the one at the front of the fifo in the slot of // the one we service - table->pending.buffer[mini % avr_int_pending_fifo_size] = + table->pending.buffer[(table->pending.read + mini) % avr_int_pending_fifo_size] = avr_int_pending_read(&table->pending); avr_raise_irq(avr->interrupts.irq + AVR_INT_IRQ_PENDING, avr_has_pending_interrupts(avr)); -- 2.39.5