Andreas Sandberg has uploaded this change for review. ( https://gem5-review.googlesource.com/3965

Change subject: sim: Prevent seqfault in the wakeCpu m5op if id is invalid
......................................................................

sim: Prevent seqfault in the wakeCpu m5op if id is invalid

Change-Id: I86229cedb206e10326cdee3f09a5c871e49c8d48
Signed-off-by: Andreas Sandberg <[email protected]>
---
M src/sim/pseudo_inst.cc
1 file changed, 8 insertions(+), 1 deletion(-)



diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index 8c2d26b..778675f 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010-2012, 2015 ARM Limited
+ * Copyright (c) 2010-2012, 2015, 2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -285,6 +285,13 @@
 {
     DPRINTF(PseudoInst, "PseudoInst::wakeCPU(%i)\n", cpuid);
     System *sys = tc->getSystemPtr();
+
+    if (sys->numContexts() <= cpuid) {
+ warn("PseudoInst::wakeCPU(%i), cpuid greater than number of contexts"
+             "(%i)\n",cpuid, sys->numContexts());
+        return;
+    }
+
     ThreadContext *other_tc = sys->threadContexts[cpuid];
     if (other_tc->status() == ThreadContext::Suspended)
         other_tc->activate();

--
To view, visit https://gem5-review.googlesource.com/3965
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I86229cedb206e10326cdee3f09a5c871e49c8d48
Gerrit-Change-Number: 3965
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to