From 5f6d462973f72504001bfd06c9874381a12214c5 Mon Sep 17 00:00:00 2001 From: Stanislaw Kaushanski Date: Tue, 26 Apr 2022 13:58:20 +0200 Subject: [PATCH] check that no interrupts are pending before entering the wfi wait --- src/sysc/core_complex.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sysc/core_complex.cpp b/src/sysc/core_complex.cpp index 3d29ee8..f7b95c7 100644 --- a/src/sysc/core_complex.cpp +++ b/src/sysc/core_complex.cpp @@ -175,9 +175,9 @@ public: void wait_until(uint64_t flags) override { SCCDEBUG(owner->name()) << "Sleeping until interrupt"; - do { + while(this->reg.pending_trap == 0 && (this->csr[arch::mip] & this->csr[arch::mie]) == 0) { sc_core::wait(wfi_evt); - } while (this->reg.pending_trap == 0); + } PLAT::wait_until(flags); }