// fetch/decode/execute loop
void processor_t::step(size_t n)
{
- // TODO: We should really not call this function at all when halted, to avoid
- // burning CPU.
- if (single_step) {
- set_halted(false, HR_NONE);
- n = 1;
+ if (state.dcsr.debugint && state.dcsr.cause == DCSR_CAUSE_NONE) {
+ enter_debug_mode(DCSR_CAUSE_DEBUGINT);
}
- while (run && !halted && n > 0) {
+ while (n > 0) {
size_t instret = 0;
reg_t pc = state.pc;
mmu_t* _mmu = mmu;
state.minstret += instret;
n -= instret;
}
-
- if (single_step) {
- single_step = false;
- set_halted(true, HR_STEPPED);
- }
}