summaryrefslogtreecommitdiff
path: root/src/sim/system.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/system.cc')
-rw-r--r--src/sim/system.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 9315882b7..e46c35611 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -55,6 +55,7 @@
#include "base/trace.hh"
#include "config/use_kvm.hh"
#if USE_KVM
+#include "cpu/kvm/base.hh"
#include "cpu/kvm/vm.hh"
#endif
#include "cpu/thread_context.hh"
@@ -335,6 +336,24 @@ System::replaceThreadContext(ThreadContext *tc, ContextID context_id)
remoteGDB[context_id]->replaceThreadContext(tc);
}
+bool
+System::validKvmEnvironment() const
+{
+#if USE_KVM
+ if (threadContexts.empty())
+ return false;
+
+ for (auto tc : threadContexts) {
+ if (dynamic_cast<BaseKvmCPU*>(tc->getCpuPtr()) == nullptr) {
+ return false;
+ }
+ }
+ return true;
+#else
+ return false;
+#endif
+}
+
Addr
System::allocPhysPages(int npages)
{