aboutsummaryrefslogtreecommitdiff
path: root/riscv/execute.cc
diff options
context:
space:
mode:
authorJerry Zhao <jerryz123@berkeley.edu>2022-12-27 11:41:27 -0800
committerJerry Zhao <jerryz123@berkeley.edu>2022-12-27 16:17:50 -0800
commit20e7f5363b6a383b4baa01f3c8a9b29fc47549a4 (patch)
treea8789fdecba029cb77804c4d9473a4c8ae475857 /riscv/execute.cc
parent591e6229238f914c5304df1b726e5b0d35d10f68 (diff)
downloadriscv-isa-sim-20e7f5363b6a383b4baa01f3c8a9b29fc47549a4.zip
riscv-isa-sim-20e7f5363b6a383b4baa01f3c8a9b29fc47549a4.tar.gz
riscv-isa-sim-20e7f5363b6a383b4baa01f3c8a9b29fc47549a4.tar.bz2
Prevent processor_t from retiring instructions after a WFI
Diffstat (limited to 'riscv/execute.cc')
-rw-r--r--riscv/execute.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc
index d36ccf6..c922602 100644
--- a/riscv/execute.cc
+++ b/riscv/execute.cc
@@ -242,6 +242,10 @@ void processor_t::step(size_t n)
try
{
take_pending_interrupt();
+ if (unlikely(in_wfi)) {
+ // No unmasked pending interrupt, so remain in wfi
+ throw wait_for_interrupt_t();
+ }
if (unlikely(slow_path()))
{
@@ -321,6 +325,7 @@ void processor_t::step(size_t n)
// allows us to switch to other threads only once per idle loop in case
// there is activity.
n = ++instret;
+ in_wfi = true;
}
state.minstret->bump(instret);