From af07a51f0b797d1d963b87269fa62b52fc22bd5f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 25 Nov 2019 23:26:08 -0800 Subject: [PATCH] arch: Switch SyscallDescABI in for SyscallDesc. This lets system calls accept arguments by putting them in their signatures. Jira Issue: https://gem5.atlassian.net/browse/GEM5-187 Change-Id: Ieb32b8b5592d894e493466717613ff16e2a03768 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23191 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- src/arch/alpha/linux/process.cc | 2 +- src/arch/alpha/linux/process.hh | 4 +++- src/arch/arm/freebsd/process.cc | 4 ++-- src/arch/arm/linux/process.cc | 8 ++++---- src/arch/mips/linux/process.cc | 2 +- src/arch/mips/linux/process.hh | 3 ++- src/arch/power/linux/process.cc | 2 +- src/arch/power/linux/process.hh | 4 +++- src/arch/riscv/linux/process.cc | 6 ++++-- src/arch/riscv/linux/process.hh | 5 +++-- src/arch/sparc/linux/process.hh | 5 +++-- src/arch/sparc/linux/syscalls.cc | 4 ++-- src/arch/sparc/solaris/process.cc | 2 +- src/arch/sparc/solaris/process.hh | 3 ++- src/arch/x86/linux/process.cc | 4 ++-- 15 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc index 2a79bbd6a..91decc79f 100644 --- a/src/arch/alpha/linux/process.cc +++ b/src/arch/alpha/linux/process.cc @@ -155,7 +155,7 @@ osf_setsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) } -SyscallDesc AlphaLinuxProcess::syscallDescs[] = { +SyscallDescABI AlphaLinuxProcess::syscallDescs[] = { /* 0 */ { "osf_syscall" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "fork" }, diff --git a/src/arch/alpha/linux/process.hh b/src/arch/alpha/linux/process.hh index 991ddbd08..14214f187 100644 --- a/src/arch/alpha/linux/process.hh +++ b/src/arch/alpha/linux/process.hh @@ -33,6 +33,8 @@ #include "arch/alpha/process.hh" +#include "sim/syscall_desc.hh" + namespace AlphaISA { /// A process with emulated Alpha/Linux syscalls. @@ -47,7 +49,7 @@ class AlphaLinuxProcess : public AlphaProcess virtual SyscallDesc* getDesc(int callnum); /// Array of syscall descriptors, indexed by call number. - static SyscallDesc syscallDescs[]; + static SyscallDescABI syscallDescs[]; const int Num_Syscall_Descs; }; diff --git a/src/arch/arm/freebsd/process.cc b/src/arch/arm/freebsd/process.cc index 55e5f8583..5a048c582 100644 --- a/src/arch/arm/freebsd/process.cc +++ b/src/arch/arm/freebsd/process.cc @@ -138,7 +138,7 @@ sysctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) } #endif -static SyscallDesc syscallDescs32[] = { +static SyscallDescABI syscallDescs32[] = { /* 0 */ { "unused#000" }, /* 1 */ { "unused#001" }, /* 2 */ { "unused#002" }, @@ -689,7 +689,7 @@ static SyscallDesc syscallDescs32[] = { /* 547 */ { "unused#547" }, }; -static SyscallDesc syscallDescs64[] = { +static SyscallDescABI syscallDescs64[] = { /* 0 */ { "unused#000" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "unused#002" }, diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index c25e91225..039148739 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -164,7 +164,7 @@ setTLSFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc) return 0; } -static SyscallDesc syscallDescs32[] = { +static SyscallDescABI syscallDescs32[] = { /* 0 */ { "syscall" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "fork" }, @@ -541,7 +541,7 @@ static SyscallDesc syscallDescs32[] = { /* 365 */ { "sys_recvmmsg" }, }; -static SyscallDesc syscallDescs64[] = { +static SyscallDescABI syscallDescs64[] = { /* 0 */ { "io_setup" }, /* 1 */ { "io_destroy" }, /* 2 */ { "io_submit" }, @@ -1632,7 +1632,7 @@ static SyscallDesc syscallDescs64[] = { /* 1079 */ { "fork" } }; -static SyscallDesc privSyscallDescs32[] = { +static SyscallDescABI privSyscallDescs32[] = { /* 1 */ { "breakpoint" }, /* 2 */ { "cacheflush" }, /* 3 */ { "usr26" }, @@ -1641,7 +1641,7 @@ static SyscallDesc privSyscallDescs32[] = { }; // Indices 1, 3 and 4 are unallocated. -static SyscallDesc privSyscallDescs64[] = { +static SyscallDescABI privSyscallDescs64[] = { /* 1 */ { "unallocated" }, /* 2 */ { "cacheflush" }, /* 3 */ { "unallocated" }, diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index e8e96da1c..0b03c9981 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -168,7 +168,7 @@ setThreadAreaFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) return 0; } -SyscallDesc MipsLinuxProcess::syscallDescs[] = { +SyscallDescABI MipsLinuxProcess::syscallDescs[] = { /* 0 */ { "syscall" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "fork" }, diff --git a/src/arch/mips/linux/process.hh b/src/arch/mips/linux/process.hh index 7fcb6f014..b2ab91e16 100644 --- a/src/arch/mips/linux/process.hh +++ b/src/arch/mips/linux/process.hh @@ -35,6 +35,7 @@ #include "arch/mips/linux/linux.hh" #include "arch/mips/process.hh" #include "sim/eventq.hh" +#include "sim/syscall_desc.hh" /// A process with emulated Mips/Linux syscalls. class MipsLinuxProcess : public MipsProcess @@ -54,7 +55,7 @@ class MipsLinuxProcess : public MipsProcess void syscall(ThreadContext *tc, Fault *fault) override; /// Array of syscall descriptors, indexed by call number. - static SyscallDesc syscallDescs[]; + static SyscallDescABI syscallDescs[]; const int Num_Syscall_Descs; }; diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index 13407789c..217f0bd97 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -96,7 +96,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) return 0; } -SyscallDesc PowerLinuxProcess::syscallDescs[] = { +SyscallDescABI PowerLinuxProcess::syscallDescs[] = { /* 0 */ { "syscall" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "fork" }, diff --git a/src/arch/power/linux/process.hh b/src/arch/power/linux/process.hh index ef96dae5f..60b38a152 100644 --- a/src/arch/power/linux/process.hh +++ b/src/arch/power/linux/process.hh @@ -35,6 +35,8 @@ #include "arch/power/process.hh" +#include "sim/syscall_desc.hh" + /// A process with emulated PPC/Linux syscalls. class PowerLinuxProcess : public PowerProcess { @@ -52,7 +54,7 @@ class PowerLinuxProcess : public PowerProcess using Process::getSyscallArg; /// Array of syscall descriptors, indexed by call number. - static SyscallDesc syscallDescs[]; + static SyscallDescABI syscallDescs[]; const int Num_Syscall_Descs; }; diff --git a/src/arch/riscv/linux/process.cc b/src/arch/riscv/linux/process.cc index add1469c9..b20d09d31 100644 --- a/src/arch/riscv/linux/process.cc +++ b/src/arch/riscv/linux/process.cc @@ -122,7 +122,8 @@ unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc) return 0; } -std::map RiscvLinuxProcess64::syscallDescs = { +std::map> + RiscvLinuxProcess64::syscallDescs = { {0, { "io_setup" }}, {1, { "io_destroy" }}, {2, { "io_submit" }}, @@ -453,7 +454,8 @@ std::map RiscvLinuxProcess64::syscallDescs = { {2011, { "getmainvars" }} }; -std::map RiscvLinuxProcess32::syscallDescs = { +std::map> + RiscvLinuxProcess32::syscallDescs = { {0, { "io_setup" }}, {1, { "io_destroy" }}, {2, { "io_submit" }}, diff --git a/src/arch/riscv/linux/process.hh b/src/arch/riscv/linux/process.hh index 65daca35e..7a2ad280e 100644 --- a/src/arch/riscv/linux/process.hh +++ b/src/arch/riscv/linux/process.hh @@ -39,6 +39,7 @@ #include "arch/riscv/linux/linux.hh" #include "arch/riscv/process.hh" #include "sim/eventq.hh" +#include "sim/syscall_desc.hh" /// A process with emulated Riscv/Linux syscalls. class RiscvLinuxProcess64 : public RiscvProcess64 @@ -58,7 +59,7 @@ class RiscvLinuxProcess64 : public RiscvProcess64 void syscall(ThreadContext *tc, Fault *fault) override; /// Array of syscall descriptors, indexed by call number. - static std::map syscallDescs; + static std::map> syscallDescs; }; class RiscvLinuxProcess32 : public RiscvProcess32 @@ -78,7 +79,7 @@ class RiscvLinuxProcess32 : public RiscvProcess32 void syscall(ThreadContext *tc, Fault *fault) override; /// Array of syscall descriptors, indexed by call number. - static std::map syscallDescs; + static std::map> syscallDescs; }; #endif // __RISCV_LINUX_PROCESS_HH__ diff --git a/src/arch/sparc/linux/process.hh b/src/arch/sparc/linux/process.hh index 5c673db26..9b1fd065f 100644 --- a/src/arch/sparc/linux/process.hh +++ b/src/arch/sparc/linux/process.hh @@ -34,6 +34,7 @@ #include "arch/sparc/linux/linux.hh" #include "arch/sparc/process.hh" #include "sim/process.hh" +#include "sim/syscall_desc.hh" namespace SparcISA { @@ -44,11 +45,11 @@ class SparcLinuxProcess { public: /// Array of syscall descriptors, indexed by call number. - static SyscallDesc syscallDescs[]; + static SyscallDescABI syscallDescs[]; /// Array of 32 bit compatibility syscall descriptors, /// indexed by call number. - static SyscallDesc syscall32Descs[]; + static SyscallDescABI syscall32Descs[]; SyscallDesc* getDesc(int callnum); SyscallDesc* getDesc32(int callnum); diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index edf53c5bf..a166a5188 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -88,7 +88,7 @@ getresuidFunc(SyscallDesc *desc, int num, ThreadContext *tc) return 0; } -SyscallDesc SparcLinuxProcess::syscall32Descs[] = { +SyscallDescABI SparcLinuxProcess::syscall32Descs[] = { /* 0 */ { "restart_syscall" }, /* 1 */ { "exit", exitFunc }, // 32 bit /* 2 */ { "fork" }, @@ -394,7 +394,7 @@ SyscallDesc SparcLinuxProcess::syscall32Descs[] = { const int SparcLinuxProcess::Num_Syscall32_Descs = sizeof(SparcLinuxProcess::syscall32Descs) / sizeof(SyscallDesc); -SyscallDesc SparcLinuxProcess::syscallDescs[] = { +SyscallDescABI SparcLinuxProcess::syscallDescs[] = { /* 0 */ { "restart_syscall" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "fork" }, diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index 69cda5356..4c22f1e4f 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -90,7 +90,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) } -SyscallDesc SparcSolarisProcess::syscallDescs[] = { +SyscallDescABI SparcSolarisProcess::syscallDescs[] = { /* 0 */ { "syscall" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "fork" }, diff --git a/src/arch/sparc/solaris/process.hh b/src/arch/sparc/solaris/process.hh index 39e3aef17..424b0ec60 100644 --- a/src/arch/sparc/solaris/process.hh +++ b/src/arch/sparc/solaris/process.hh @@ -34,6 +34,7 @@ #include "arch/sparc/solaris/solaris.hh" #include "arch/sparc/process.hh" #include "sim/process.hh" +#include "sim/syscall_desc.hh" namespace SparcISA { @@ -52,7 +53,7 @@ class SparcSolarisProcess : public Sparc64Process void syscall(ThreadContext *tc, Fault *fault) override; /// Array of syscall descriptors, indexed by call number. - static SyscallDesc syscallDescs[]; + static SyscallDescABI syscallDescs[]; const int Num_Syscall_Descs; }; diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index f79317841..10ee11291 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -257,7 +257,7 @@ setThreadArea32Func(SyscallDesc *desc, int callnum, ThreadContext *tc) return 0; } -static SyscallDesc syscallDescs64[] = { +static SyscallDescABI syscallDescs64[] = { /* 0 */ { "read", readFunc }, /* 1 */ { "write", writeFunc }, /* 2 */ { "open", openFunc }, @@ -597,7 +597,7 @@ X86_64LinuxProcess::clone(ThreadContext *old_tc, ThreadContext *new_tc, X86_64Process::clone(old_tc, new_tc, (X86_64Process*)process, flags); } -static SyscallDesc syscallDescs32[] = { +static SyscallDescABI syscallDescs32[] = { /* 0 */ { "restart_syscall" }, /* 1 */ { "exit", exitFunc }, /* 2 */ { "fork" }, -- 2.30.2