Severin, thanks for the patch. Please post it on reviews.gem5.org, the
website we use for reviewing patches.
--
Nilay
On Mon, 7 Jul 2014, Severin Wischmann via gem5-dev wrote:
# HG changeset patch
# User Severin Wischmann <wisev...@student.ethz.ch>
# Date 1404719147 -7200
# Mon Jul 07 09:45:47 2014 +0200
# Node ID 37d917e78e64340166c2d6c235de8804d7bb2f71
# Parent 878f2f30b12d38f619b80b5d80d52498946f6ad1
Implementation of exit_group on X86.
The system call would kill all processes/threads on all cpus.
With this commit only the threads associated with one process get
killed.
diff -r 878f2f30b12d -r 37d917e78e64 src/sim/syscall_emul.cc
--- a/src/sim/syscall_emul.cc Wed Jul 02 13:19:13 2014 -0400
+++ b/src/sim/syscall_emul.cc Mon Jul 07 09:45:47 2014 +0200
@@ -132,11 +132,23 @@
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);
+ if (process->system->numRunningContexts() == 1) {
+ // Last running context... exit simulator
+ int index = 0;
+ exitSimLoop("target called exit()",
+ process->getSyscallArg(tc, index) & 0xff);
+ } else {
+ // other running processes... halt all threads belonging to this one
+ for (auto i: process->contextIds) {
+ process->system->getThreadContext(i)->halt();
+ }
+ if (!process->system->numRunningContexts()) {
+ // all remaining threads belonged to this process... exit simulator
+ int index = 0;
+ exitSimLoop("target called exit()",
+ process->getSyscallArg(tc, index) & 0xff);
+ }
+ }
return 1;
}
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev