summaryrefslogtreecommitdiff
path: root/src/sim/pseudo_inst.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2015-12-14 17:10:36 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2015-12-14 17:10:36 +0000
commit08754488a30da178effd0414f198462bf268d715 (patch)
tree1813e805a3ba8e294599e08eafad832993402420 /src/sim/pseudo_inst.cc
parentf5f04c312096e56f09ea27e84d3d2d2a97be97f9 (diff)
downloadgem5-08754488a30da178effd0414f198462bf268d715.tar.xz
sim: Add an option to forward work items to Python
There are cases where we want the Python world to handle work items instead of the C++ world. However, that's currently not possible. This changeset adds the forward_work_items option to the System class. Then it is set to True, work items will generate workbegin/workend simulation exists with the work item ID as the exit code and the old C++ handling is completely bypassed. --HG-- extra : rebase_source : 8de637a744fc4b6ff2bc763f00cdf8ddf2bff885
Diffstat (limited to 'src/sim/pseudo_inst.cc')
-rw-r--r--src/sim/pseudo_inst.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index fb19b21b1..260ffec6e 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2012 ARM Limited
+ * Copyright (c) 2010-2012, 2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -616,13 +616,18 @@ void
workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid)
{
DPRINTF(PseudoInst, "PseudoInst::workbegin(%i, %i)\n", workid, threadid);
- tc->getCpuPtr()->workItemBegin();
System *sys = tc->getSystemPtr();
const System::Params *params = sys->params();
- sys->workItemBegin(threadid, workid);
- DPRINTF(WorkItems, "Work Begin workid: %d, threadid %d\n", workid,
+ if (params->exit_on_work_items) {
+ exitSimLoop("workbegin", static_cast<int>(workid));
+ return;
+ }
+
+ DPRINTF(WorkItems, "Work Begin workid: %d, threadid %d\n", workid,
threadid);
+ tc->getCpuPtr()->workItemBegin();
+ sys->workItemBegin(threadid, workid);
//
// If specified, determine if this is the specific work item the user
@@ -674,12 +679,17 @@ void
workend(ThreadContext *tc, uint64_t workid, uint64_t threadid)
{
DPRINTF(PseudoInst, "PseudoInst::workend(%i, %i)\n", workid, threadid);
- tc->getCpuPtr()->workItemEnd();
System *sys = tc->getSystemPtr();
const System::Params *params = sys->params();
- sys->workItemEnd(threadid, workid);
+
+ if (params->exit_on_work_items) {
+ exitSimLoop("workend", static_cast<int>(workid));
+ return;
+ }
DPRINTF(WorkItems, "Work End workid: %d, threadid %d\n", workid, threadid);
+ tc->getCpuPtr()->workItemEnd();
+ sys->workItemEnd(threadid, workid);
//
// If specified, determine if this is the specific work item the user