From 82d57d9b0bbd396d13de639ce1fdffe7cf591b72 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 27 Nov 2019 23:53:28 -0800 Subject: [PATCH] arm: Convert ARM specific syscalls to GuestABI. Jira Issue: https://gem5.atlassian.net/browse/GEM5-187 Change-Id: I1055b72f34ea9e0bcce465492bd45b6fb0c36eef Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23200 Reviewed-by: Bobby R. Bruce Maintainer: Gabe Black Tested-by: kokoro --- src/arch/arm/freebsd/process.cc | 13 +++---------- src/arch/arm/linux/process.cc | 26 +++++++++----------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/arch/arm/freebsd/process.cc b/src/arch/arm/freebsd/process.cc index 5a048c582..58edefc47 100644 --- a/src/arch/arm/freebsd/process.cc +++ b/src/arch/arm/freebsd/process.cc @@ -94,19 +94,12 @@ issetugidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) #if !defined ( __GNU_LIBRARY__ ) static SyscallReturn -sysctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) +sysctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, + Addr namep, size_t nameLen, Addr oldp, Addr oldlenp, + Addr newp, size_t newlen) { - 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); - Addr oldlenp = process->getSyscallArg(tc, index); - Addr newp = process->getSyscallArg(tc, index); - size_t newlen = process->getSyscallArg(tc, index); - BufferArg buf(namep, sizeof(size_t)); BufferArg buf2(oldp, sizeof(size_t)); BufferArg buf3(oldlenp, sizeof(size_t)); diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 1f9feaeeb..6ed37b048 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -100,11 +100,10 @@ ArmLinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) +unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc, Addr utsname) { - int index = 0; auto process = tc->getProcessPtr(); - TypedBufferArg name(process->getSyscallArg(tc, index)); + TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename, "m5.eecs.umich.edu"); @@ -118,11 +117,10 @@ unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) /// Target uname() handler. static SyscallReturn -unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) +unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc, Addr utsname) { - int index = 0; auto process = tc->getProcessPtr(); - TypedBufferArg name(process->getSyscallArg(tc, index)); + TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename, "gem5"); @@ -136,25 +134,19 @@ unameFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) /// Target set_tls() handler. static SyscallReturn -setTLSFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) +setTLSFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc, + uint32_t tlsPtr) { - int index = 0; - auto process = tc->getProcessPtr(); - uint32_t tlsPtr = process->getSyscallArg(tc, index); - tc->getVirtProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0, &tlsPtr, sizeof(tlsPtr)); - tc->setMiscReg(MISCREG_TPIDRURO,tlsPtr); + tc->setMiscReg(MISCREG_TPIDRURO, tlsPtr); return 0; } static SyscallReturn -setTLSFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) +setTLSFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc, + uint32_t tlsPtr) { - int index = 0; - auto process = tc->getProcessPtr(); - uint32_t tlsPtr = process->getSyscallArg(tc, index); - tc->setMiscReg(MISCREG_TPIDRRO_EL0, tlsPtr); return 0; } -- 2.30.2