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/x86 | |
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/x86')
-rw-r--r-- | src/arch/x86/linux/process.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 95f4ee91d..98a68b409 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -91,10 +91,10 @@ X86LinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +unameFunc(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"); @@ -109,8 +109,7 @@ unameFunc(SyscallDesc *desc, int callnum, Process *process, } static SyscallReturn -archPrctlFunc(SyscallDesc *desc, int callnum, Process *process, - ThreadContext *tc) +archPrctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) { enum ArchPrctlCodes { @@ -122,6 +121,7 @@ archPrctlFunc(SyscallDesc *desc, int callnum, Process *process, // First argument is the code, second is the address int index = 0; + auto process = tc->getProcessPtr(); int code = process->getSyscallArg(tc, index); uint64_t addr = process->getSyscallArg(tc, index); uint64_t fsBase, gsBase; @@ -175,13 +175,14 @@ struct UserDesc64 { }; static SyscallReturn -setThreadArea32Func(SyscallDesc *desc, int callnum, - Process *process, ThreadContext *tc) +setThreadArea32Func(SyscallDesc *desc, int callnum, ThreadContext *tc) { const int minTLSEntry = 6; const int numTLSEntries = 3; const int maxTLSEntry = minTLSEntry + numTLSEntries - 1; + auto process = tc->getProcessPtr(); + X86Process *x86p = dynamic_cast<X86Process *>(process); assert(x86p); |