arch,sim: Merge Process::syscall and Process::getDesc.
When handling a system call, external code would call Process::syscall which would extract the syscall number, that would call the base class' doSyscall method, that would call into the subclass' getDesc to get the appropriate descriptor, and then doSyscall would check that a syscall was found and call into it. Instead, we can just make the SyscallDescTable optionally check for missing syscalls (in case we want to check multiple tables), and make syscall look up the appropriate descriptor and call it. The base implementation of syscall would then do the only bit of doSyscall that is no longer being handled, incrementing the numSyscalls stat. Change-Id: If102c156830ed2997d177dc6937cc85dddadf3f9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24119 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com> Maintainer: Gabe Black <gabeblack@google.com> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -861,30 +861,6 @@ ArmLinuxProcess64::ArmLinuxProcess64(ProcessParams * params,
|
||||
|
||||
const Addr ArmLinuxProcess32::commPage = 0xffff0000;
|
||||
|
||||
SyscallDesc*
|
||||
ArmLinuxProcess32::getDesc(int callnum)
|
||||
{
|
||||
SyscallDesc *desc = syscallDescs32Low.get(callnum);
|
||||
if (desc)
|
||||
return desc;
|
||||
desc = syscallDescs32Low.get(callnum);
|
||||
if (desc)
|
||||
return desc;
|
||||
return privSyscallDescs32.get(callnum);
|
||||
}
|
||||
|
||||
SyscallDesc*
|
||||
ArmLinuxProcess64::getDesc(int callnum)
|
||||
{
|
||||
SyscallDesc *desc = syscallDescs64Low.get(callnum);
|
||||
if (desc)
|
||||
return desc;
|
||||
desc = syscallDescs64Low.get(callnum);
|
||||
if (desc)
|
||||
return desc;
|
||||
return privSyscallDescs64.get(callnum);
|
||||
}
|
||||
|
||||
void
|
||||
ArmLinuxProcess32::initState()
|
||||
{
|
||||
@@ -942,11 +918,27 @@ ArmLinuxProcess64::initState()
|
||||
void
|
||||
ArmLinuxProcess32::syscall(ThreadContext *tc, Fault *fault)
|
||||
{
|
||||
doSyscall(tc->readIntReg(INTREG_R7), tc, fault);
|
||||
ArmProcess32::syscall(tc, fault);
|
||||
|
||||
int num = tc->readIntReg(INTREG_R7);
|
||||
SyscallDesc *desc = syscallDescs32Low.get(num, false);
|
||||
if (!desc)
|
||||
desc = syscallDescs32Low.get(num, false);
|
||||
if (!desc)
|
||||
desc = privSyscallDescs32.get(num);
|
||||
desc->doSyscall(tc, fault);
|
||||
}
|
||||
|
||||
void
|
||||
ArmLinuxProcess64::syscall(ThreadContext *tc, Fault *fault)
|
||||
{
|
||||
doSyscall(tc->readIntReg(INTREG_X8), tc, fault);
|
||||
ArmProcess64::syscall(tc, fault);
|
||||
|
||||
int num = tc->readIntReg(INTREG_X8);
|
||||
SyscallDesc *desc = syscallDescs64Low.get(num, false);
|
||||
if (!desc)
|
||||
desc = syscallDescs64Low.get(num, false);
|
||||
if (!desc)
|
||||
desc = privSyscallDescs64.get(num);
|
||||
desc->doSyscall(tc, fault);
|
||||
}
|
||||
|
||||
@@ -87,8 +87,6 @@ class ArmLinuxProcess32 : public ArmProcess32, public ArmLinuxProcessBits
|
||||
/// A page to hold "kernel" provided functions. The name might be wrong.
|
||||
static const Addr commPage;
|
||||
|
||||
SyscallDesc* getDesc(int callnum) override;
|
||||
|
||||
struct SyscallABI : public ArmProcess32::SyscallABI,
|
||||
public ArmLinuxProcessBits::SyscallABI
|
||||
{};
|
||||
@@ -103,7 +101,6 @@ class ArmLinuxProcess64 : public ArmProcess64, public ArmLinuxProcessBits
|
||||
|
||||
void initState() override;
|
||||
void syscall(ThreadContext *tc, Fault *fault) override;
|
||||
SyscallDesc* getDesc(int callnum) override;
|
||||
|
||||
struct SyscallABI : public ArmProcess64::SyscallABI,
|
||||
public ArmLinuxProcessBits::SyscallABI
|
||||
|
||||
Reference in New Issue
Block a user