gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Private Attributes | List of all members
SyscallDesc Class Reference

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>

Inheritance diagram for SyscallDesc:
SyscallDescABI< ABI > SyscallDescABI< DefaultSyscallABI >

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...
 

Detailed Description

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.

Member Typedef Documentation

◆ SyscallExecutor

Definition at line 72 of file syscall_desc.hh.

Constructor & Destructor Documentation

◆ SyscallDesc()

SyscallDesc::SyscallDesc ( const char *  name,
SyscallExecutor  sys_exec = unimplementedFunc 
)
inline

Definition at line 74 of file syscall_desc.hh.

References doSyscall().

Referenced by SyscallDescABI< DefaultSyscallABI >::SyscallDescABI().

Member Function Documentation

◆ doSyscall()

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.

Parameters
callnumNumber associated with call (by operating system)
procHandle for the owning Process to pass information
tcHandle 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().

◆ name()

std::string SyscallDesc::name ( )
inline

Definition at line 88 of file syscall_desc.hh.

References _name.

Referenced by ignoreFunc(), ignoreWarnOnceFunc(), openatFunc(), setThreadArea32Func(), and unimplementedFunc().

Member Data Documentation

◆ _name

std::string SyscallDesc::_name
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().

◆ executor

SyscallExecutor SyscallDesc::executor
private

Mechanism for ISAs to connect to the emul function definitions.

Definition at line 95 of file syscall_desc.hh.

Referenced by doSyscall().


The documentation for this class was generated from the following files:

Generated on Fri Feb 28 2020 16:27:17 for gem5 by doxygen 1.8.13