diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-08-20 11:46:13 -0700 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-08-20 11:46:13 -0700 |
commit | 283be34a992401f07d62e274d501c4185fca8377 (patch) | |
tree | 14b04337496b5addb3d65a0eef627709fd954150 /src/dev/intel_8254_timer.cc | |
parent | b6d08e0455a9256a157d683eb31c7af541c30ce9 (diff) | |
download | gem5-283be34a992401f07d62e274d501c4185fca8377.tar.xz |
devices: Fixed periodic interrupts to work with draining
Added drain functions to the RTC and 8254 timer so that periodic interrupts
stop when the system is draining. This patch is needed to checkpoint in
timing mode. Otherwise under certain situations, the event queue will never
be completely empty.
Diffstat (limited to 'src/dev/intel_8254_timer.cc')
-rw-r--r-- | src/dev/intel_8254_timer.cc | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/dev/intel_8254_timer.cc b/src/dev/intel_8254_timer.cc index 9e507b968..b61aa7c56 100644 --- a/src/dev/intel_8254_timer.cc +++ b/src/dev/intel_8254_timer.cc @@ -32,6 +32,7 @@ #include "base/misc.hh" #include "dev/intel_8254_timer.hh" +#include "sim/sim_object.hh" using namespace std; @@ -69,6 +70,17 @@ Intel8254Timer::writeControl(const CtrlReg data) } } +unsigned int +Intel8254Timer::drain(Event *de) +{ + unsigned int count = 0; + count += counter[0]->drain(de); + count += counter[1]->drain(de); + count += counter[2]->drain(de); + assert(count == 0); + return count; +} + void Intel8254Timer::serialize(const string &base, ostream &os) { @@ -216,6 +228,18 @@ Intel8254Timer::Counter::outputHigh() return output_high; } +unsigned int +Intel8254Timer::Counter::drain(Event *de) +{ + if (event.scheduled()) { + event_tick = event.when(); + parent->deschedule(event); + } else { + event_tick = 0; + } + return 0; +} + void Intel8254Timer::Counter::serialize(const string &base, ostream &os) { @@ -227,10 +251,6 @@ Intel8254Timer::Counter::serialize(const string &base, ostream &os) paramOut(os, base + ".latch_on", latch_on); paramOut(os, base + ".read_byte", read_byte); paramOut(os, base + ".write_byte", write_byte); - - Tick event_tick = 0; - if (event.scheduled()) - event_tick = event.when(); paramOut(os, base + ".event_tick", event_tick); } @@ -247,7 +267,6 @@ Intel8254Timer::Counter::unserialize(const string &base, Checkpoint *cp, paramIn(cp, section, base + ".read_byte", read_byte); paramIn(cp, section, base + ".write_byte", write_byte); - Tick event_tick; paramIn(cp, section, base + ".event_tick", event_tick); if (event_tick) parent->schedule(event, event_tick); |