sim-se: add new getpgrp system call
authorBrandon Potter <brandon.potter@amd.com>
Mon, 11 Mar 2019 18:24:33 +0000 (14:24 -0400)
committerBrandon Potter <Brandon.Potter@amd.com>
Tue, 6 Aug 2019 20:47:28 +0000 (20:47 +0000)
This changeset adds new (relatively simple) system call
support. The getpgrp call returns a thread context's
pgid.

Change-Id: I361bdbfb9c01b761ddd5a4923d23f86971f8d614
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17111
Maintainer: Brandon Potter <Brandon.Potter@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ayaz Akram <yazakram@ucdavis.edu>
src/arch/x86/linux/process.cc
src/sim/syscall_emul.cc
src/sim/syscall_emul.hh

index 9ffde7f90b4c9c1bb60b66233344174277df4a3f..8f669bfa597545f68ed98fa68f3de806080fb46e 100644 (file)
@@ -373,7 +373,7 @@ static SyscallDesc syscallDescs64[] = {
     /* 108 */ SyscallDesc("getegid", getegidFunc),
     /* 109 */ SyscallDesc("setpgid", setpgidFunc),
     /* 110 */ SyscallDesc("getppid", getppidFunc),
-    /* 111 */ SyscallDesc("getpgrp", unimplementedFunc),
+    /* 111 */ SyscallDesc("getpgrp", getpgrpFunc),
     /* 112 */ SyscallDesc("setsid", unimplementedFunc),
     /* 113 */ SyscallDesc("setreuid", unimplementedFunc),
     /* 114 */ SyscallDesc("setregid", unimplementedFunc),
index 28e3e3ded21b3b2634b1b66529e6c1c928316982..088dcbcce44210d0753b7dd61bc3be54ba326a32 100644 (file)
@@ -982,6 +982,13 @@ pipe2Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
     return pipeImpl(desc, callnum, tc, false, true);
 }
 
+SyscallReturn
+getpgrpFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
+{
+    auto process = tc->getProcessPtr();
+    return process->pgid();
+}
+
 SyscallReturn
 setpgidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 {
index 875f565cde2482a3de176cc76904523845193d99..130791d20e358c32287bb8a0ef20695356e5fa46 100644 (file)
@@ -226,6 +226,9 @@ SyscallReturn gettidFunc(SyscallDesc *desc, int num, ThreadContext *tc);
 /// Target chown() handler.
 SyscallReturn chownFunc(SyscallDesc *desc, int num, ThreadContext *tc);
 
+/// Target getpgrpFunc() handler.
+SyscallReturn getpgrpFunc(SyscallDesc *desc, int num, ThreadContext *tc);
+
 /// Target setpgid() handler.
 SyscallReturn setpgidFunc(SyscallDesc *desc, int num, ThreadContext *tc);