From 86a788fd3f45ca7c594a7618ad9bcffc48e9715d Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sun, 21 Apr 2024 22:48:52 +0200 Subject: [PATCH] interrupt scheduling debugging --- cpu.cpp | 2 +- cpu.h | 1 + debugger.cpp | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cpu.cpp b/cpu.cpp index 3425057..9a362d1 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -392,7 +392,7 @@ bool cpu::execute_any_pending_interrupt() if (interrupts->second.empty() == false) { any_queued_interrupts = true; - if (i < start_level) + if (i < start_level) // at leas we know now that there's an interrupt scheduled continue; if (can_trigger == false) { diff --git a/cpu.h b/cpu.h index a6028cf..c968ca2 100644 --- a/cpu.h +++ b/cpu.h @@ -141,6 +141,7 @@ public: void queue_interrupt(const uint8_t level, const uint8_t vector); std::map > get_queued_interrupts() const { return queued_interrupts; } std::optional get_interrupt_delay_left() const { return trap_delay; } + bool check_if_interrupts_pending() const { return any_queued_interrupts; } void trap(uint16_t vector, const int new_ipl = -1, const bool is_interrupt = false); bool is_it_a_trap() const { return it_is_a_trap; } diff --git a/debugger.cpp b/debugger.cpp index 1a9e921..3cac428 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -726,6 +726,8 @@ void show_queued_interrupts(console *const cnsl, cpu *const c) else cnsl->put_string_lf("No delay"); + cnsl->put_string_lf(format("Interrupt pending flag: %d", c->check_if_interrupts_pending())); + auto queued_interrupts = c->get_queued_interrupts(); for(auto & level: queued_interrupts) {