From: Gabe Black Date: Thu, 7 May 2020 12:32:00 +0000 (-0700) Subject: arch: Use VPtr for uname. X-Git-Tag: v20.1.0.0~341 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93a01dba47c113c8b04170d6fceef46c6c9aece2;p=gem5.git arch: Use VPtr for uname. Change-Id: Ia4b6c9135f16e6c68bbcf3a9c15ba7433a0a6682 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29403 Maintainer: Gabe Black Tested-by: kokoro Reviewed-by: Matthew Poremba --- diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index a78c8e2ac..65f1cd15e 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -100,10 +100,9 @@ ArmLinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc32(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc32(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename, "m5.eecs.umich.edu"); @@ -111,16 +110,14 @@ unameFunc32(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012"); strcpy(name->machine, "armv7l"); - name.copyOut(tc->getVirtProxy()); return 0; } /// Target uname() handler. static SyscallReturn -unameFunc64(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc64(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename, "gem5"); @@ -128,7 +125,6 @@ unameFunc64(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012"); strcpy(name->machine, "armv8l"); - name.copyOut(tc->getVirtProxy()); return 0; } diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index b8b22674a..8f1ec1621 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -77,10 +77,9 @@ MipsLinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename,"sim.gem5.org"); @@ -88,7 +87,6 @@ unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "mips"); - name.copyOut(tc->getVirtProxy()); return 0; } @@ -103,10 +101,9 @@ sys_getsysinfoFunc(SyscallDesc *desc, ThreadContext *tc, unsigned op, case 45: { // GSI_IEEE_FP_CONTROL - TypedBufferArg fpcr(bufPtr); + VPtr fpcr(bufPtr, tc); // I don't think this exactly matches the HW FPCR *fpcr = 0; - fpcr.copyOut(tc->getVirtProxy()); return 0; } default: @@ -128,11 +125,11 @@ sys_setsysinfoFunc(SyscallDesc *desc, ThreadContext *tc, unsigned op, case 14: { // SSI_IEEE_FP_CONTROL - TypedBufferArg fpcr(bufPtr); + ConstVPtr fpcr(bufPtr, tc); // I don't think this exactly matches the HW FPCR fpcr.copyIn(tc->getVirtProxy()); DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): " - " setting FPCR to 0x%x\n", letoh(*(uint64_t*)fpcr)); + " setting FPCR to 0x%x\n", letoh(*fpcr)); return 0; } default: diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index d613d52c1..fd07947e9 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -76,10 +76,9 @@ PowerLinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename, "sim.gem5.org"); @@ -87,7 +86,6 @@ unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "power"); - name.copyOut(tc->getVirtProxy()); return 0; } diff --git a/src/arch/riscv/linux/process.cc b/src/arch/riscv/linux/process.cc index e70a07f9f..fa6bf0188 100644 --- a/src/arch/riscv/linux/process.cc +++ b/src/arch/riscv/linux/process.cc @@ -84,10 +84,9 @@ RiscvLinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc64(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc64(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename,"sim.gem5.org"); @@ -95,16 +94,14 @@ unameFunc64(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "riscv64"); - name.copyOut(tc->getVirtProxy()); return 0; } /// Target uname() handler. static SyscallReturn -unameFunc32(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc32(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename,"sim.gem5.org"); @@ -112,7 +109,6 @@ unameFunc32(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "riscv32"); - name.copyOut(tc->getVirtProxy()); return 0; } diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index 3eaba9162..304f2cfdb 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -37,10 +37,9 @@ namespace SparcISA { /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename, "sim.gem5.org"); @@ -48,8 +47,6 @@ unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "sparc"); - name.copyOut(tc->getVirtProxy()); - return 0; } diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index f1a13caa7..63f1a0fa7 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -70,10 +70,9 @@ SparcSolarisObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "SunOS"); strcpy(name->nodename, "m5.eecs.umich.edu"); @@ -81,8 +80,6 @@ unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "Generic_118558-21"); strcpy(name->machine, "sun4u"); - name.copyOut(tc->getVirtProxy()); - return 0; } diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index b0e87c0ce..9460a4b06 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -89,10 +89,9 @@ X86LinuxObjectFileLoader loader; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) +unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr name) { auto process = tc->getProcessPtr(); - TypedBufferArg name(utsname); strcpy(name->sysname, "Linux"); strcpy(name->nodename, "sim.gem5.org"); @@ -100,8 +99,6 @@ unameFunc(SyscallDesc *desc, ThreadContext *tc, Addr utsname) strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "x86_64"); - name.copyOut(tc->getVirtProxy()); - return 0; } @@ -167,7 +164,8 @@ struct UserDesc64 { }; static SyscallReturn -setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc, Addr userDescPtr) +setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc, + VPtr userDesc) { const int minTLSEntry = 6; const int numTLSEntries = 3; @@ -180,14 +178,10 @@ setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc, Addr userDescPtr) assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86p->gdtSize()); - TypedBufferArg userDesc(userDescPtr); TypedBufferArg gdt(x86p->gdtStart() + minTLSEntry * sizeof(uint64_t), numTLSEntries * sizeof(uint64_t)); - if (!userDesc.copyIn(tc->getVirtProxy())) - return -EFAULT; - if (!gdt.copyIn(tc->getVirtProxy())) panic("Failed to copy in GDT for %s.\n", desc->name()); @@ -240,8 +234,6 @@ setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc, Addr userDescPtr) gdt[index] = (uint64_t)segDesc; - if (!userDesc.copyOut(tc->getVirtProxy())) - return -EFAULT; if (!gdt.copyOut(tc->getVirtProxy())) panic("Failed to copy out GDT for %s.\n", desc->name());