summaryrefslogtreecommitdiff
path: root/src/cpu/simple/atomic.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:41 -0500
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:41 -0500
commit7eb0fb8b6ebffcb39b61964d4c7387455c262aae (patch)
tree99ded4ee2e8740b415c0b7b5ad7b808fbcbe405e /src/cpu/simple/atomic.cc
parent94561dd5268d139b721561166cbce94170701c2c (diff)
downloadgem5-7eb0fb8b6ebffcb39b61964d4c7387455c262aae.tar.xz
cpu: Check that the memory system is in the correct mode
This patch adds checks to all CPU models to make sure that the memory system is in the correct mode at startup and when resuming after a drain. Previously, we only checked that the memory system was in the right mode when resuming. This is inadequate since this is a configuration error that should be detected at startup as well as when resuming. Additionally, since the check was done using an assert, it wasn't performed when NDEBUG was set (e.g., the fast target).
Diffstat (limited to 'src/cpu/simple/atomic.cc')
-rw-r--r--src/cpu/simple/atomic.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc
index e63d998a7..fffbb55d6 100644
--- a/src/cpu/simple/atomic.cc
+++ b/src/cpu/simple/atomic.cc
@@ -83,6 +83,12 @@ AtomicSimpleCPU::init()
{
BaseCPU::init();
+ if (!params()->defer_registration &&
+ system->getMemoryMode() != Enums::atomic) {
+ fatal("The atomic CPU requires the memory system to be in "
+ "'atomic' mode.\n");
+ }
+
// Initialise the ThreadContext's memory proxies
tcBase()->initMemProxies(tcBase());
@@ -155,7 +161,10 @@ AtomicSimpleCPU::drainResume()
return;
DPRINTF(SimpleCPU, "Resume\n");
- assert(system->getMemoryMode() == Enums::atomic);
+ if (system->getMemoryMode() != Enums::atomic) {
+ fatal("The atomic CPU requires the memory system to be in "
+ "'atomic' mode.\n");
+ }
setDrainState(Drainable::Running);
if (thread->status() == ThreadContext::Active) {