46 #ifndef __SIM_SYSCALL_DESC_HH__ 47 #define __SIM_SYSCALL_DESC_HH__ 72 std::function<SyscallReturn(SyscallDesc *, int num, ThreadContext *)>;
103 template <
typename ABI>
108 template <
typename ...Args>
113 template <
typename ...Args>
120 template <
typename ...Args>
128 auto partial = [target,desc,num](
130 return target(desc, num, tc, args...);
136 std::function<SyscallReturn(ThreadContext *, Args...)>(
144 template <
typename ...Args>
149 template <
typename ...Args>
176 template <
typename Arg>
178 typename
std::enable_if<std::is_integral<Arg>::value>
::type>
188 template <
typename Arg>
190 typename
std::enable_if<std::is_pointer<Arg>::value>
::type>
196 RegVal reg = process->getSyscallArg(tc, position);
197 return (Arg)(uintptr_t)(reg);
203 #endif // __SIM_SYSCALL_DESC_HH__
void doSyscall(int callnum, ThreadContext *tc, Fault *fault)
Interface for invoking the system call funcion pointer.
std::function< SyscallReturn(SyscallDesc *, int, ThreadContext *, Args...)> SyscallABIExecutor
virtual Process * getProcessPtr()=0
Overload hash function for BasicBlockRange type.
static SyscallExecutor buildExecutor(SyscallABIExecutor< Args... > target)
ThreadContext is the external interface to all thread state for anything outside of the CPU...
std::function< SyscallReturn(SyscallDesc *, int num, ThreadContext *)> SyscallExecutor
static void store(ThreadContext *tc, const SyscallReturn &ret)
SyscallExecutor executor
Mechanism for ISAs to connect to the emul function definitions.
virtual RegVal getSyscallArg(ThreadContext *tc, int &i)=0
std::string _name
System call name (e.g., open, mmap, clone, socket, etc.)
SyscallDescABI(const char *name, SyscallABIExecutor< Args... > target)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
This class provides the wrapper interface for the system call implementations which are defined in th...
SyscallDescABI(const char *name, SyscallABIExecutorPtr< Args... > target)
SyscallReturn unimplementedFunc(SyscallDesc *desc, int num, ThreadContext *tc)
SyscallReturn(*)(SyscallDesc *, int, ThreadContext *, Args...) SyscallABIExecutorPtr
Ret invokeSimcall(ThreadContext *tc, std::function< Ret(ThreadContext *, Args...)> target)
virtual void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value)=0
This class represents the return value from an emulated system call, including any errno setting...
std::shared_ptr< FaultBase > Fault
SyscallDesc(const char *name, SyscallExecutor sys_exec=unimplementedFunc)