Fix allocating requests twice on retries.

--HG--
extra : convert_revision : 7b3324ed41e24b69b3e793005ebc07a7d72a3763
This commit is contained in:
Kevin Lim
2006-06-09 12:28:11 -04:00
parent e6a6204b17
commit 02606ebb26

View 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);