changeset 8e18835c0dea in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=8e18835c0dea
description:
        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 <[email protected]>

diffstat:

 src/sim/syscall_emul.cc |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (26 lines):

diff -r f1baf4f7723f -r 8e18835c0dea src/sim/syscall_emul.cc
--- a/src/sim/syscall_emul.cc   Thu Oct 16 05:50:01 2014 -0400
+++ b/src/sim/syscall_emul.cc   Mon Oct 20 16:43:48 2014 -0500
@@ -135,11 +135,17 @@
 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;
 }
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to