From dd8a7694806e3f816ba688d2094106db68b46b53 Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Tue, 28 Aug 2018 10:13:04 -0400 Subject: 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 Maintainer: Brandon Potter Tested-by: kokoro --- src/arch/sparc/linux/syscalls.cc | 7 ++++--- src/arch/sparc/solaris/process.cc | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/arch/sparc') diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index 773982a50..9cf08b7b3 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -39,10 +39,10 @@ namespace SparcISA { /// 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 name(process->getSyscallArg(tc, index)); strcpy(name->sysname, "Linux"); @@ -58,10 +58,11 @@ unameFunc(SyscallDesc *desc, int callnum, Process *process, SyscallReturn -getresuidFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) +getresuidFunc(SyscallDesc *desc, int num, ThreadContext *tc) { const uint64_t id = htog(100); int index = 0; + auto p = tc->getProcessPtr(); Addr ruid = p->getSyscallArg(tc, index); Addr euid = p->getSyscallArg(tc, index); Addr suid = p->getSyscallArg(tc, index); diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index 70381c5d8..0b67f53d3 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -72,10 +72,10 @@ SparcSolarisObjectFileLoader 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 name(process->getSyscallArg(tc, index)); strcpy(name->sysname, "SunOS"); -- cgit v1.2.3