summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-05-18 22:54:19 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2006-05-18 22:54:19 -0400
commit86777c9db174c74be49667bce3dda99f8ba23696 (patch)
tree977260677d5e3f726811d919a0b1a36251398a59 /cpu
parent796fa429fef8b038278c4a020374149d8b5ef8eb (diff)
downloadgem5-86777c9db174c74be49667bce3dda99f8ba23696.tar.xz
First steps toward getting full system to work with
TimingSimpleCPU. Not there yet. cpu/simple/atomic.cc: Only read SC result if store was an SC. Don't fake SC here; fake it in PhysicalMemory so all CPU models can share in the joy. cpu/simple/timing.cc: Don't forget to checkForInterrupts(). Only fetch subsequent instruction if we're still running (i.e. not quiesced). dev/io_device.hh: Initialize port pointer in SendEvent object. mem/physical.cc: Move fake SC "implementation" here from AtomicSimpleCPU. mem/request.hh: Initialize flags to all clear, not uninitialized. Otherwise we can't reliably look at flags w/o explicitly setting them every time we create a request. --HG-- extra : convert_revision : ae7601ce6fb54c54e19848aa5391327f9a6e61a6
Diffstat (limited to 'cpu')
-rw-r--r--cpu/simple/atomic.cc12
-rw-r--r--cpu/simple/timing.cc13
2 files changed, 16 insertions, 9 deletions
diff --git a/cpu/simple/atomic.cc b/cpu/simple/atomic.cc
index c09f16ada..e9422b9c0 100644
--- a/cpu/simple/atomic.cc
+++ b/cpu/simple/atomic.cc
@@ -349,20 +349,16 @@ AtomicSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
dcache_access = true;
assert(data_write_pkt->result == Success);
- }
- if (res && (fault == NoFault))
- *res = data_write_pkt->result;
+ if (res && data_write_req->getFlags() & LOCKED) {
+ *res = data_write_req->getScResult();
+ }
+ }
// This will need a new way to tell if it's hooked up to a cache or not.
if (data_write_req->getFlags() & UNCACHEABLE)
recordEvent("Uncached Write");
- // @todo this is a hack and only works on uniprocessor systems
- // some one else can implement LL/SC.
- if (data_write_req->getFlags() & LOCKED)
- *res = 1;
-
// If the write needs to have a fault on the access, consider calling
// changeStatus() and changing it to "bad addr write" or something.
return fault;
diff --git a/cpu/simple/timing.cc b/cpu/simple/timing.cc
index 80d3380a5..70b88c4b1 100644
--- a/cpu/simple/timing.cc
+++ b/cpu/simple/timing.cc
@@ -75,6 +75,9 @@ TimingSimpleCPU::CpuPort::recvFunctional(Packet *pkt)
void
TimingSimpleCPU::CpuPort::recvStatusChange(Status status)
{
+ if (status == RangeChange)
+ return;
+
panic("TimingSimpleCPU doesn't expect recvStatusChange callback!");
}
@@ -342,6 +345,8 @@ TimingSimpleCPU::write(int32_t data, Addr addr, unsigned flags, uint64_t *res)
void
TimingSimpleCPU::fetch()
{
+ checkForInterrupts();
+
Request *ifetch_req = new Request(true);
ifetch_req->setSize(sizeof(MachInst));
@@ -380,7 +385,12 @@ TimingSimpleCPU::completeInst(Fault fault)
advancePC(fault);
- fetch();
+ if (_status == Running) {
+ // kick off fetch of next instruction... callback from icache
+ // response will cause that instruction to be executed,
+ // keeping the CPU running.
+ fetch();
+ }
}
@@ -397,6 +407,7 @@ TimingSimpleCPU::completeIfetch()
Fault fault = curStaticInst->initiateAcc(this, traceData);
assert(fault == NoFault);
assert(_status == DcacheWaitResponse);
+ // instruction will complete in dcache response callback
} else {
// non-memory instruction: execute completely now
Fault fault = curStaticInst->execute(this, traceData);