This guarantees interrupts will eventually be taken.
npc = sext_xlen(x); \
} while(0)
+#define set_pc_and_serialize(x) \
+ do { set_pc(x); /* check alignment */ \
+ npc = PC_SERIALIZE; \
+ STATE.pc = (x); \
+ } while(0)
+
#define PC_SERIALIZE 3 /* sentinel value indicating simulator pipeline flush */
/* Convenience wrappers to simplify softfloat code sequences */
require_privilege(PRV_S);
switch (STATE.prv)
{
- case PRV_S: set_pc(p->get_state()->sepc); break;
- case PRV_M: set_pc(p->get_state()->mepc); break;
+ case PRV_S: set_pc_and_serialize(p->get_state()->sepc); break;
+ case PRV_M: set_pc_and_serialize(p->get_state()->mepc); break;
default: abort();
}