gem5
v19.0.0.0
|
This class provides the wrapper interface for the system call implementations which are defined in the sim/syscall_emul files and bound to the ISAs in the architecture specific code (i.e. More...
#include <syscall_desc.hh>
Public Types | |
using | SyscallExecutor = std::function< SyscallReturn(SyscallDesc *, int num, ThreadContext *)> |
Public Member Functions | |
SyscallDesc (const char *name, SyscallExecutor sys_exec=unimplementedFunc) | |
void | doSyscall (int callnum, ThreadContext *tc, Fault *fault) |
Interface for invoking the system call funcion pointer. More... | |
std::string | name () |
Private Attributes | |
std::string | _name |
System call name (e.g., open, mmap, clone, socket, etc.) More... | |
SyscallExecutor | executor |
Mechanism for ISAs to connect to the emul function definitions. More... | |
This class provides the wrapper interface for the system call implementations which are defined in the sim/syscall_emul files and bound to the ISAs in the architecture specific code (i.e.
arch/X86/linux/process.cc).
Definition at line 69 of file syscall_desc.hh.
using SyscallDesc::SyscallExecutor = std::function<SyscallReturn(SyscallDesc *, int num, ThreadContext *)> |
Definition at line 72 of file syscall_desc.hh.
|
inline |
Definition at line 74 of file syscall_desc.hh.
References doSyscall().
Referenced by SyscallDescABI< DefaultSyscallABI >::SyscallDescABI().
void SyscallDesc::doSyscall | ( | int | callnum, |
ThreadContext * | tc, | ||
Fault * | fault | ||
) |
Interface for invoking the system call funcion pointer.
Note that this acts as a gateway for all system calls and serves a good point to add filters for behaviors or apply checks for all system calls.
callnum | Number associated with call (by operating system) |
proc | Handle for the owning Process to pass information |
tc | Handle for owning ThreadContext to pass information |
Step through the first six parameters for the system call and retrieve their values. Note that index is incremented as a side-effect of the getSyscallArg method.
Linux supports up to six system call arguments through registers so we want to print all six. Check to the relevant man page to verify how many are actually used by a given system call.
Invoke the system call
If the system call needs to be restarted, most likely due to blocking behavior, warn that the system call will retry; alternatively, print the return value.
Definition at line 48 of file syscall_desc.cc.
References _name, DPRINTF_SYSCALL, SyscallReturn::encodedValue(), executor, ThreadContext::getProcessPtr(), ArmISA::i, MipsISA::index, M5_VAR_USED, SyscallReturn::needsRetry(), and SyscallReturn::suppressed().
Referenced by Process::doSyscall(), and SyscallDesc().
|
inline |
Definition at line 88 of file syscall_desc.hh.
References _name.
Referenced by ignoreFunc(), ignoreWarnOnceFunc(), openatFunc(), setThreadArea32Func(), and unimplementedFunc().
|
private |
System call name (e.g., open, mmap, clone, socket, etc.)
Definition at line 92 of file syscall_desc.hh.
Referenced by doSyscall(), and name().
|
private |
Mechanism for ISAs to connect to the emul function definitions.
Definition at line 95 of file syscall_desc.hh.
Referenced by doSyscall().