Skip to content

Commit

Permalink
Regularly trigger the Supervisor-Mode Timer Interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Jan 23, 2024
1 parent 1bcf19a commit ddedb86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions riscv_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ int target_read_slow(RISCVCPUState *s, mem_uint_t *pval,
char read_input(void);
ret = read_input();

if (ret == 'a') { riscv_cpu_set_mip(s, MIP_STIP); }////

// Clear the Input Buffer
void set_input(char ch);
set_input(0);
Expand Down
4 changes: 4 additions & 0 deletions riscv_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,10 @@ static int riscv_machine_get_sleep_duration(VirtMachine *s1, int delay)
}
if (!riscv_cpu_get_power_down(s))
delay = 0;

//// Begin Test: Trigger the Supervisor-Mode Timer Interrupt
static uint64_t t = 0; if (t++ % 100 == 0) { riscv_cpu_set_mip(s, MIP_STIP); } ////
//// End Test
return delay;
}

Expand Down

0 comments on commit ddedb86

Please sign in to comment.