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 <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2019-11-25 23:26:08 -08:00
parent a255a2ee64
commit af07a51f0b
15 changed files with 34 additions and 24 deletions

View File

@@ -155,7 +155,7 @@ osf_setsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
}
SyscallDesc AlphaLinuxProcess::syscallDescs[] = {
SyscallDescABI<DefaultSyscallABI> AlphaLinuxProcess::syscallDescs[] = {
/* 0 */ { "osf_syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },

View File

@@ -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<DefaultSyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
};

View File

@@ -138,7 +138,7 @@ sysctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
}
#endif
static SyscallDesc syscallDescs32[] = {
static SyscallDescABI<DefaultSyscallABI> 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<DefaultSyscallABI> syscallDescs64[] = {
/* 0 */ { "unused#000" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "unused#002" },

View File

@@ -164,7 +164,7 @@ setTLSFunc64(SyscallDesc *desc, int callnum, ThreadContext *tc)
return 0;
}
static SyscallDesc syscallDescs32[] = {
static SyscallDescABI<DefaultSyscallABI> syscallDescs32[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },
@@ -541,7 +541,7 @@ static SyscallDesc syscallDescs32[] = {
/* 365 */ { "sys_recvmmsg" },
};
static SyscallDesc syscallDescs64[] = {
static SyscallDescABI<DefaultSyscallABI> syscallDescs64[] = {
/* 0 */ { "io_setup" },
/* 1 */ { "io_destroy" },
/* 2 */ { "io_submit" },
@@ -1632,7 +1632,7 @@ static SyscallDesc syscallDescs64[] = {
/* 1079 */ { "fork" }
};
static SyscallDesc privSyscallDescs32[] = {
static SyscallDescABI<DefaultSyscallABI> 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<DefaultSyscallABI> privSyscallDescs64[] = {
/* 1 */ { "unallocated" },
/* 2 */ { "cacheflush" },
/* 3 */ { "unallocated" },

View File

@@ -168,7 +168,7 @@ setThreadAreaFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
return 0;
}
SyscallDesc MipsLinuxProcess::syscallDescs[] = {
SyscallDescABI<DefaultSyscallABI> MipsLinuxProcess::syscallDescs[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },

View File

@@ -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<DefaultSyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
};

View File

@@ -96,7 +96,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
return 0;
}
SyscallDesc PowerLinuxProcess::syscallDescs[] = {
SyscallDescABI<DefaultSyscallABI> PowerLinuxProcess::syscallDescs[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },

View File

@@ -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<DefaultSyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
};

View File

@@ -122,7 +122,8 @@ unameFunc32(SyscallDesc *desc, int callnum, ThreadContext *tc)
return 0;
}
std::map<int, SyscallDesc> RiscvLinuxProcess64::syscallDescs = {
std::map<int, SyscallDescABI<DefaultSyscallABI>>
RiscvLinuxProcess64::syscallDescs = {
{0, { "io_setup" }},
{1, { "io_destroy" }},
{2, { "io_submit" }},
@@ -453,7 +454,8 @@ std::map<int, SyscallDesc> RiscvLinuxProcess64::syscallDescs = {
{2011, { "getmainvars" }}
};
std::map<int, SyscallDesc> RiscvLinuxProcess32::syscallDescs = {
std::map<int, SyscallDescABI<DefaultSyscallABI>>
RiscvLinuxProcess32::syscallDescs = {
{0, { "io_setup" }},
{1, { "io_destroy" }},
{2, { "io_submit" }},

View File

@@ -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<int, SyscallDesc> syscallDescs;
static std::map<int, SyscallDescABI<DefaultSyscallABI>> 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<int, SyscallDesc> syscallDescs;
static std::map<int, SyscallDescABI<DefaultSyscallABI>> syscallDescs;
};
#endif // __RISCV_LINUX_PROCESS_HH__

View File

@@ -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<DefaultSyscallABI> syscallDescs[];
/// Array of 32 bit compatibility syscall descriptors,
/// indexed by call number.
static SyscallDesc syscall32Descs[];
static SyscallDescABI<DefaultSyscallABI> syscall32Descs[];
SyscallDesc* getDesc(int callnum);
SyscallDesc* getDesc32(int callnum);

View File

@@ -88,7 +88,7 @@ getresuidFunc(SyscallDesc *desc, int num, ThreadContext *tc)
return 0;
}
SyscallDesc SparcLinuxProcess::syscall32Descs[] = {
SyscallDescABI<DefaultSyscallABI> 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<DefaultSyscallABI> SparcLinuxProcess::syscallDescs[] = {
/* 0 */ { "restart_syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },

View File

@@ -90,7 +90,7 @@ unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
}
SyscallDesc SparcSolarisProcess::syscallDescs[] = {
SyscallDescABI<DefaultSyscallABI> SparcSolarisProcess::syscallDescs[] = {
/* 0 */ { "syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },

View File

@@ -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<DefaultSyscallABI> syscallDescs[];
const int Num_Syscall_Descs;
};

View File

@@ -257,7 +257,7 @@ setThreadArea32Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
return 0;
}
static SyscallDesc syscallDescs64[] = {
static SyscallDescABI<DefaultSyscallABI> syscallDescs64[] = {
/* 0 */ { "read", readFunc<X86Linux64> },
/* 1 */ { "write", writeFunc<X86Linux64> },
/* 2 */ { "open", openFunc<X86Linux64> },
@@ -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<DefaultSyscallABI> syscallDescs32[] = {
/* 0 */ { "restart_syscall" },
/* 1 */ { "exit", exitFunc },
/* 2 */ { "fork" },