summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-03-02 17:49:12 -0500
committerAli Saidi <saidi@eecs.umich.edu>2006-03-02 17:49:12 -0500
commit0fed64a6a47a62a94a53c5f41ac89b34a2fd6786 (patch)
tree845d914e1d1dea03d588c4fbeaf6a0788f023e81
parent1624d9e5458fbd02d2e21c6d88f78769680b78b0 (diff)
downloadgem5-0fed64a6a47a62a94a53c5f41ac89b34a2fd6786.tar.xz
Fix fault handling, dereferincing a null pointer is bad.
--HG-- extra : convert_revision : a4f658bfd39b7f1d219ad8929b8f45457f49299f
-rw-r--r--cpu/simple/cpu.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc
index d826c589e..ca5d54694 100644
--- a/cpu/simple/cpu.cc
+++ b/cpu/simple/cpu.cc
@@ -347,12 +347,12 @@ SimpleCPU::copySrcTranslate(Addr src)
// translate to physical address
Fault fault = xc->translateDataReadReq(memReq);
- assert(!fault->isAlignmentFault());
-
if (fault == NoFault) {
xc->copySrcAddr = src;
xc->copySrcPhysAddr = memReq->paddr + offset;
} else {
+ assert(!fault->isAlignmentFault());
+
xc->copySrcAddr = 0;
xc->copySrcPhysAddr = 0;
}
@@ -382,8 +382,6 @@ SimpleCPU::copy(Addr dest)
// translate to physical address
Fault fault = xc->translateDataWriteReq(memReq);
- assert(!fault->isAlignmentFault());
-
if (fault == NoFault) {
Addr dest_addr = memReq->paddr + offset;
// Need to read straight from memory since we have more than 8 bytes.
@@ -402,6 +400,9 @@ SimpleCPU::copy(Addr dest)
dcacheInterface->access(memReq);
}
}
+ else
+ assert(!fault->isAlignmentFault());
+
return fault;
}