diff options
author | Brandon Potter <brandon.potter@amd.com> | 2018-08-28 10:13:04 -0400 |
---|---|---|
committer | Brandon Potter <Brandon.Potter@amd.com> | 2019-05-21 20:42:38 +0000 |
commit | dd8a7694806e3f816ba688d2094106db68b46b53 (patch) | |
tree | 8fc6bcc3e474ae3843779f6d019b296e28a8848b /src/arch/arm | |
parent | dd2d44547ddc08ccee9e1465104eff2f43efdec0 (diff) | |
download | gem5-dd8a7694806e3f816ba688d2094106db68b46b53.tar.xz |
sim-se: change syscall function signature
The system calls had four parameters. One of the parameters
is ThreadContext and another is Process. The ThreadContext
holds the value of the current process so the Process parameter
is redundant since the system call functions already have
indirect access.
With the old API, it is possible to call into the functions with
the wrong supplied Process which could end up being a confusing
error.
This patch removes the redundancy by forcing access through the
ThreadContext field within each system call.
Change-Id: Ib43d3f65824f6d425260dfd9f67de1892b6e8b7c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/12299
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/arch/arm')
-rw-r--r-- | src/arch/arm/freebsd/process.cc | 8 | ||||
-rw-r--r-- | src/arch/arm/linux/process.cc | 16 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/arch/arm/freebsd/process.cc b/src/arch/arm/freebsd/process.cc index ba79eb18b..41549eaab 100644 --- a/src/arch/arm/freebsd/process.cc +++ b/src/arch/arm/freebsd/process.cc @@ -85,20 +85,18 @@ ArmFreebsdObjectFileLoader loader; } // anonymous namespace static SyscallReturn -issetugidFunc(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +issetugidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) { - return 0; } static SyscallReturn -sysctlFunc(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +sysctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) { int index = 0; uint64_t ret; + auto process = tc->getProcessPtr(); Addr namep = process->getSyscallArg(tc, index); size_t namelen = process->getSyscallArg(tc, index); Addr oldp = process->getSyscallArg(tc, index); diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index cd37c770a..1bb754870 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -105,10 +105,10 @@ ArmLinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc32(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) { int index = 0; + auto process = tc->getProcessPtr(); TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); strcpy(name->sysname, "Linux"); @@ -123,10 +123,10 @@ unameFunc32(SyscallDesc *desc, int callnum, Process *process, /// Target uname() handler. static SyscallReturn -unameFunc64(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) { int index = 0; + auto process = tc->getProcessPtr(); TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); strcpy(name->sysname, "Linux"); @@ -141,10 +141,10 @@ unameFunc64(SyscallDesc *desc, int callnum, Process *process, /// Target set_tls() handler. static SyscallReturn -setTLSFunc32(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +setTLSFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) { int index = 0; + auto process = tc->getProcessPtr(); uint32_t tlsPtr = process->getSyscallArg(tc, index); tc->getMemProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0, @@ -154,10 +154,10 @@ setTLSFunc32(SyscallDesc *desc, int callnum, Process *process, } static SyscallReturn -setTLSFunc64(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +setTLSFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) { int index = 0; + auto process = tc->getProcessPtr(); uint32_t tlsPtr = process->getSyscallArg(tc, index); tc->setMiscReg(MISCREG_TPIDRRO_EL0, tlsPtr); |