CPU: Update where the simple cpus read their cpu id from the thread context to init...
authorAli Saidi <saidi@eecs.umich.edu>
Sun, 16 Dec 2007 08:48:13 +0000 (03:48 -0500)
committerAli Saidi <saidi@eecs.umich.edu>
Sun, 16 Dec 2007 08:48:13 +0000 (03:48 -0500)
--HG--
extra : convert_revision : 4f2801967a271b43817d88e147c2f80c4480b2c3

src/cpu/simple/atomic.cc
src/cpu/simple/base.cc
src/cpu/simple/timing.cc

index aead5aadaf8bc7dafb338438b8f90ce7cd6b3506..4553c0ae2de6aba62a68e81a2497b1c7ebe41824 100644 (file)
@@ -79,12 +79,13 @@ void
 AtomicSimpleCPU::init()
 {
     BaseCPU::init();
+    cpuId = tc->readCpuId();
 #if FULL_SYSTEM
     for (int i = 0; i < threadContexts.size(); ++i) {
         ThreadContext *tc = threadContexts[i];
 
         // initialize CPU, including PC
-        TheISA::initCPU(tc, tc->readCpuId());
+        TheISA::initCPU(tc, cpuId);
     }
 #endif
     if (hasPhysMemPort) {
@@ -93,6 +94,9 @@ AtomicSimpleCPU::init()
         physmemPort.getPeerAddressRanges(pmAddrList, snoop);
         physMemAddr = *pmAddrList.begin();
     }
+    ifetch_req.setThreadContext(cpuId, 0); // Add thread ID if we add MT
+    data_read_req.setThreadContext(cpuId, 0); // Add thread ID here too
+    data_write_req.setThreadContext(cpuId, 0); // Add thread ID here too
 }
 
 bool
@@ -159,9 +163,6 @@ AtomicSimpleCPU::AtomicSimpleCPU(Params *p)
     icachePort.snoopRangeSent = false;
     dcachePort.snoopRangeSent = false;
 
-    ifetch_req.setThreadContext(cpuId, 0); // Add thread ID if we add MT
-    data_read_req.setThreadContext(cpuId, 0); // Add thread ID here too
-    data_write_req.setThreadContext(cpuId, 0); // Add thread ID here too
 }
 
 
@@ -240,6 +241,9 @@ AtomicSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
     }
     assert(threadContexts.size() == 1);
     cpuId = tc->readCpuId();
+    ifetch_req.setThreadContext(cpuId, 0); // Add thread ID if we add MT
+    data_read_req.setThreadContext(cpuId, 0); // Add thread ID here too
+    data_write_req.setThreadContext(cpuId, 0); // Add thread ID here too
 }
 
 
index ad7b14be30ad5e7faab66f77b6bbe0dfed27ca08..367f38b8930610bf87cd456125a322b24633a214 100644 (file)
@@ -91,7 +91,6 @@ BaseSimpleCPU::BaseSimpleCPU(Params *p)
 
     threadContexts.push_back(tc);
 
-    cpuId = tc->readCpuId();
 
     fetchOffset = 0;
     stayAtPC = false;
index 8d6a169abe37df880b87ec13e425bbb4a6b9378f..2f3ee5c73c25f9ac4f927159034dfe202f48fa4b 100644 (file)
@@ -57,12 +57,13 @@ void
 TimingSimpleCPU::init()
 {
     BaseCPU::init();
+    cpuId = tc->readCpuId();
 #if FULL_SYSTEM
     for (int i = 0; i < threadContexts.size(); ++i) {
         ThreadContext *tc = threadContexts[i];
 
         // initialize CPU, including PC
-        TheISA::initCPU(tc, tc->readCpuId());
+        TheISA::initCPU(tc, cpuId);
     }
 #endif
 }