Browse Source

Fix Scott's deadlock

Not Scott's fault, I mean
confprec
Andrew Waterman 13 years ago
parent
commit
2deb1197bc
  1. 7
      riscv/htif.cc
  2. 4
      riscv/htif.h
  3. 7
      riscv/sim.cc

7
riscv/htif.cc

@ -15,9 +15,14 @@ htif_isasim_t::htif_isasim_t(sim_t* _sim, const std::vector<std::string>& args)
{
}
void htif_isasim_t::tick()
bool htif_isasim_t::tick()
{
if (done())
return false;
do tick_once(); while (reset);
return true;
}
void htif_isasim_t::tick_once()

4
riscv/htif.h

@ -17,8 +17,7 @@ class htif_isasim_t : public htif_pthread_t
{
public:
htif_isasim_t(sim_t* _sim, const std::vector<std::string>& args);
void tick();
bool done();
bool tick();
private:
sim_t* sim;
@ -26,6 +25,7 @@ private:
uint8_t seqno;
void tick_once();
bool done();
};
#endif

7
riscv/sim.cc

@ -74,9 +74,8 @@ reg_t sim_t::get_scr(int which)
void sim_t::run()
{
while (!htif->done())
while (htif->tick())
{
htif->tick();
if (debug || ctrlc_pressed)
interactive();
else
@ -115,6 +114,6 @@ bool sim_t::running()
void sim_t::stop()
{
procs[0]->state.tohost = 1;
while (!htif->done())
htif->tick();
while (htif->tick())
;
}

Loading…
Cancel
Save