summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2018-08-28 18:02:58 -0400
committerBrandon Potter <Brandon.Potter@amd.com>2019-08-02 15:55:32 +0000
commit7bd5f554b53ee8763fd20e2cd214539d3ec93158 (patch)
treeaffb22bd776ec97e473c7e8d6d5f443417e73fd9 /src/sim
parent334b8377f35b183148dfda3a7a5d71bee2990b81 (diff)
downloadgem5-7bd5f554b53ee8763fd20e2cd214539d3ec93158.tar.xz
sim-se: small refactor on pipe syscall
Change-Id: I02ffb1c4af980554ff12ac7d11d32ba80fe261c5 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/12308 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/syscall_emul.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index eaf90ec76..142292d1f 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -868,8 +868,14 @@ fcntl64Func(SyscallDesc *desc, int num, ThreadContext *tc)
SyscallReturn
pipeImpl(SyscallDesc *desc, int callnum, ThreadContext *tc, bool pseudoPipe)
{
- int sim_fds[2], tgt_fds[2];
+ Addr tgt_addr = 0;
auto p = tc->getProcessPtr();
+ if (!pseudoPipe) {
+ int index = 0;
+ tgt_addr = p->getSyscallArg(tc, index);
+ }
+
+ int sim_fds[2], tgt_fds[2];
int pipe_retval = pipe(sim_fds);
if (pipe_retval == -1)
@@ -898,9 +904,6 @@ pipeImpl(SyscallDesc *desc, int callnum, ThreadContext *tc, bool pseudoPipe)
return tgt_fds[0];
}
- int index = 0;
- Addr tgt_addr = p->getSyscallArg(tc, index);
-
/**
* Copy the target file descriptors into buffer space and then copy
* the buffer space back into the target address space.