Fix allocating requests twice on retries.
authorKevin Lim <ktlim@umich.edu>
Fri, 9 Jun 2006 16:28:11 +0000 (12:28 -0400)
committerKevin Lim <ktlim@umich.edu>
Fri, 9 Jun 2006 16:28:11 +0000 (12:28 -0400)
--HG--
extra : convert_revision : 7b3324ed41e24b69b3e793005ebc07a7d72a3763

src/cpu/base_dyn_inst.hh

index 263a245219bc31b760bd9ab7fb24de0ca5447a5e..948ee058ad444c1ebef75fe5f4b5b19421123df0 100644 (file)
@@ -654,16 +654,16 @@ template<class T>
 inline Fault
 BaseDynInst<Impl>::read(Addr addr, T &data, unsigned flags)
 {
-    if (executed) {
-        panic("Not supposed to re-execute with split mem ops!");
-        fault = cpu->read(req, data, lqIdx);
-        return fault;
+    // Sometimes reads will get retried, so they may come through here
+    // twice.
+    if (!req) {
+        req = new Request();
+        req->setVirt(asid, addr, sizeof(T), flags, this->PC);
+        req->setThreadContext(thread->readCpuId(), threadNumber);
+    } else {
+        assert(addr == req->getVaddr());
     }
 
-    req = new Request();
-    req->setVirt(asid, addr, sizeof(T), flags, this->PC);
-    req->setThreadContext(thread->readCpuId(), threadNumber);
-
     if ((req->getVaddr() & (TheISA::VMPageSize - 1)) + req->getSize() >
         TheISA::VMPageSize) {
         return TheISA::genAlignmentFault();
@@ -715,6 +715,8 @@ BaseDynInst<Impl>::write(T data, Addr addr, unsigned flags, uint64_t *res)
         traceData->setData(data);
     }
 
+    assert(req == NULL);
+
     req = new Request();
     req->setVirt(asid, addr, sizeof(T), flags, this->PC);
     req->setThreadContext(thread->readCpuId(), threadNumber);