sim: Make the syscalls use the SyscallReturn suppression mechanism.
authorGabe Black <gabeblack@google.com>
Fri, 22 Nov 2019 23:40:58 +0000 (15:40 -0800)
committerGabe Black <gabeblack@google.com>
Tue, 10 Dec 2019 23:58:14 +0000 (23:58 +0000)
This, among other things, prevents them from needing to toggle global
flags in the syscall desc table to control local behavior.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-187

Change-Id: Idcef23766084f10d5205721b54a6768a850f7eb9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23167
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
src/sim/syscall_desc.cc
src/sim/syscall_emul.hh

index 345bfa114996b871ba51ca82526ac05bb730d802..bf378fe20bd999d42aed31ce0846168dd34535fe 100644 (file)
@@ -81,7 +81,7 @@ SyscallDesc::doSyscall(int callnum, ThreadContext *tc, Fault *fault)
     } else
         DPRINTF_SYSCALL(Base, "%s returns %d\n", _name, retval.encodedValue());
 
-    if (!(_flags & SyscallDesc::SuppressReturnValue) && !retval.needsRetry())
+    if (!retval.suppressed() && !retval.needsRetry())
         process->setSyscallReturn(tc, retval);
 }
 
index fc6ed62d150410bfbec3b31ac1131fffea8bf1b1..e467b0bff459568e6824dc07a503721a217dfae3 100644 (file)
@@ -2131,7 +2131,6 @@ template <class OS>
 SyscallReturn
 execveFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 {
-    desc->setFlags(0);
     auto p = tc->getProcessPtr();
 
     int index = 0;
@@ -2215,8 +2214,7 @@ execveFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
     TheISA::PCState pcState = tc->pcState();
     tc->setNPC(pcState.instAddr());
 
-    desc->setFlags(SyscallDesc::SuppressReturnValue);
-    return 0;
+    return SyscallReturn();
 }
 
 /// Target getrusage() function.