aboutsummaryrefslogtreecommitdiff
path: root/riscv/decode.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/decode.h')
-rw-r--r--riscv/decode.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index 4ad4549..72efcd9 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -159,7 +159,11 @@ private:
npc = sext_xlen(x); \
} while(0)
+#define PC_SERIALIZE 3 /* sentinel value indicating simulator pipeline flush */
+
#define validate_csr(which, write) ({ \
+ if (!STATE.serialized) return PC_SERIALIZE; \
+ STATE.serialized = false; \
unsigned my_priv = get_field(STATE.mstatus, MSTATUS_PRV); \
unsigned csr_priv = get_field((which), 0x300); \
unsigned csr_read_only = get_field((which), 0xC00) == 3; \