summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorSeverin Wischmann ext:(%2C%20Ioannis%20Ilkos%20%3Cioannis.ilkos09%40imperial.ac.uk%3E) <wiseveri@student.ethz.ch>2014-10-20 16:43:48 -0500
committerSeverin Wischmann ext:(%2C%20Ioannis%20Ilkos%20%3Cioannis.ilkos09%40imperial.ac.uk%3E) <wiseveri@student.ethz.ch>2014-10-20 16:43:48 -0500
commite72736aaf0508dd545ae9949c31ed91ba41d761b (patch)
tree94b78ab3c3226a97d5f27e9dbb8a794a652a96a3 /src/sim
parent6d4866383feac65beaf8ac5fa18557569e25481d (diff)
downloadgem5-e72736aaf0508dd545ae9949c31ed91ba41d761b.tar.xz
x86: syscall: implementation of exit_group
On exit_group syscall, we used to exit the simulator. But now we will only halt the execution of threads that belong to the group. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/syscall_emul.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 13ea784e5..d8df891dd 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -135,11 +135,17 @@ SyscallReturn
exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- // really should just halt all thread contexts belonging to this
- // process in case there's another process running...
- int index = 0;
- exitSimLoop("target called exit()",
- process->getSyscallArg(tc, index) & 0xff);
+ // halt all threads belonging to this process
+ for (auto i: process->contextIds) {
+ process->system->getThreadContext(i)->halt();
+ }
+
+ if (!process->system->numRunningContexts()) {
+ // all threads belonged to this process... exit simulator
+ int index = 0;
+ exitSimLoop("target called exit()",
+ process->getSyscallArg(tc, index) & 0xff);
+ }
return 1;
}