simavr: Do not call avr_terminate in run callbacks
authorJakob Gruber <jakob.gruber@gmail.com>
Thu, 26 Jul 2012 11:05:21 +0000 (13:05 +0200)
committerJakob Gruber <jakob.gruber@gmail.com>
Thu, 26 Jul 2012 12:40:46 +0000 (14:40 +0200)
Neither run_avr nor the examples expect avr_terminate to be called by
simavr itself.
This also caused issues for cleanup code (such as IRQ disconnections)
that did not know if avr_terminate had already been called or not.

simavr/sim/sim_avr.c

index 37fae8f..7869f0d 100644 (file)
@@ -233,7 +233,6 @@ void avr_callback_run_gdb(avr_t * avr)
                if (!avr->sreg[S_I]) {
                        if (avr->log)
                                printf("simavr: sleeping with interrupts off, quitting gracefully\n");
-                       avr_terminate(avr);
                        avr->state = cpu_Done;
                        return;
                }
@@ -288,7 +287,6 @@ void avr_callback_run_raw(avr_t * avr)
                if (!avr->sreg[S_I]) {
                        if (avr->log)
                                printf("simavr: sleeping with interrupts off, quitting gracefully\n");
-                       avr_terminate(avr);
                        avr->state = cpu_Done;
                        return;
                }