summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2008-06-15 21:34:32 -0700
committerNathan Binkert <nate@binkert.org>2008-06-15 21:34:32 -0700
commite3c267a3dbe628516777dd74662c786ef4eedceb (patch)
tree1896fcf08d73fb919ef361e678fddc044cb976a9 /src/cpu
parentb429b1759defba2f8da1f894f6a3500e3f2c78d2 (diff)
downloadgem5-e3c267a3dbe628516777dd74662c786ef4eedceb.tar.xz
port: Clean up default port setup and port switchover code.
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/base.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 23195f720..6ce082996 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -351,22 +351,17 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc)
// Connect new CPU to old CPU's memory only if new CPU isn't
// connected to anything. Also connect old CPU's memory to new
// CPU.
- Port *peer;
- if (ic->getPeer() == NULL || ic->getPeer()->isDefaultPort()) {
- peer = oldCPU->getPort("icache_port")->getPeer();
+ if (!ic->isConnected()) {
+ Port *peer = oldCPU->getPort("icache_port")->getPeer();
ic->setPeer(peer);
- } else {
- peer = ic->getPeer();
+ peer->setPeer(ic);
}
- peer->setPeer(ic);
- if (dc->getPeer() == NULL || dc->getPeer()->isDefaultPort()) {
- peer = oldCPU->getPort("dcache_port")->getPeer();
+ if (!dc->isConnected()) {
+ Port *peer = oldCPU->getPort("dcache_port")->getPeer();
dc->setPeer(peer);
- } else {
- peer = dc->getPeer();
+ peer->setPeer(dc);
}
- peer->setPeer(dc);
}