Commit 5bc1f43dbedbb3d38fafaff0f60868377756e02f
authorMax Schwarz <max.schwarz@online.de>
Mon, 26 Oct 2015 11:15:30 +0000 (12:15 +0100)
committerMax Schwarz <max.schwarz@online.de>
Mon, 26 Oct 2015 11:15:30 +0000 (12:15 +0100)
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

index 0022795a3a369aba19b74ca7a2bad92d710dc271..651af3ee8115775c32f6d9ce88779b8d190a82f3 100644 (file)
@@ -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));