Fix for bug when draining and a memory access is outstanding.

--HG--
extra : convert_revision : 1af782cf023ae74c2a3ff9f7aefcea880bc87936
This commit is contained in:
Kevin Lim 2006-07-07 16:48:44 -04:00
parent b2a479cfc8
commit 744e0055b7

View file

@ -354,22 +354,23 @@ DefaultFetch<Impl>::processCacheCompletion(PacketPtr pkt)
// to return. // to return.
if (fetchStatus[tid] != IcacheWaitResponse || if (fetchStatus[tid] != IcacheWaitResponse ||
pkt->req != memReq[tid] || pkt->req != memReq[tid] ||
isSwitchedOut() || isSwitchedOut()) {
drainPending) {
++fetchIcacheSquashes; ++fetchIcacheSquashes;
delete pkt->req; delete pkt->req;
delete pkt; delete pkt;
return; return;
} }
// Wake up the CPU (if it went to sleep and was waiting on this completion if (!drainPending) {
// event). // Wake up the CPU (if it went to sleep and was waiting on
// this completion event).
cpu->wakeCPU(); cpu->wakeCPU();
DPRINTF(Activity, "[tid:%u] Activating fetch due to cache completion\n", DPRINTF(Activity, "[tid:%u] Activating fetch due to cache completion\n",
tid); tid);
switchToActive(); switchToActive();
}
// Only switch to IcacheAccessComplete if we're not stalled as well. // Only switch to IcacheAccessComplete if we're not stalled as well.
if (checkStall(tid)) { if (checkStall(tid)) {
@ -509,7 +510,7 @@ DefaultFetch<Impl>::fetchCacheLine(Addr fetch_PC, Fault &ret_fault, unsigned tid
unsigned flags = 0; unsigned flags = 0;
#endif // FULL_SYSTEM #endif // FULL_SYSTEM
if (cacheBlocked || (interruptPending && flags == 0) || drainPending) { if (cacheBlocked || (interruptPending && flags == 0)) {
// Hold off fetch from getting new instructions when: // Hold off fetch from getting new instructions when:
// Cache is blocked, or // Cache is blocked, or
// while an interrupt is pending and we're not in PAL mode, or // while an interrupt is pending and we're not in PAL mode, or
@ -909,7 +910,7 @@ DefaultFetch<Impl>::fetch(bool &status_change)
////////////////////////////////////////// //////////////////////////////////////////
int tid = getFetchingThread(fetchPolicy); int tid = getFetchingThread(fetchPolicy);
if (tid == -1) { if (tid == -1 || drainPending) {
DPRINTF(Fetch,"There are no more threads available to fetch from.\n"); DPRINTF(Fetch,"There are no more threads available to fetch from.\n");
// Breaks looping condition in tick() // Breaks looping condition in tick()