summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r--src/sim/syscall_emul.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 5fe30c269..f0a693db0 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -42,6 +42,7 @@
#include "cpu/base.hh"
#include "mem/page_table.hh"
#include "sim/process.hh"
+#include "sim/system.hh"
#include "sim/sim_exit.hh"
@@ -91,9 +92,13 @@ SyscallReturn
exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
ThreadContext *tc)
{
- if (tc->exit()) {
+ if (process->system->numRunningContexts() == 1) {
+ // Last running context... exit simulator
exitSimLoop("target called exit()",
- process->getSyscallArg(tc, 0) & 0xff);
+ process->getSyscallArg(tc, 0) & 0xff);
+ } else {
+ // other running threads... just halt this one
+ tc->halt();
}
return 1;