Go to the documentation of this file.
42 #ifndef __SIM_SYSCALL_DESC_HH__
43 #define __SIM_SYSCALL_DESC_HH__
109 template <
typename ABI>
114 template <
typename ...Args>
118 template <
typename ...Args>
125 template <
typename ...Args>
133 auto partial = [target,desc](
135 return target(desc, tc, args...);
146 template <
typename ...Args>
157 template <
typename ...Args>
163 template <
typename ...Args>
179 template <
typename ABI>
183 std::map<int, SyscallDescABI<ABI>>
_descs;
188 for (
auto &desc: descs) {
189 auto res =
_descs.insert({desc.num(), desc});
190 panic_if(!res.second,
"Failed to insert desc %s", desc.name());
195 *
get(
int num,
bool fatal_if_missing=
true)
197 auto it =
_descs.find(num);
199 if (fatal_if_missing)
200 fatal(
"Syscall %d out of range", num);
208 #endif // __SIM_SYSCALL_DESC_HH__
#define fatal(...)
This implements a cprintf based fatal() function.
SyscallReturn(*)(SyscallDesc *, ThreadContext *, Args...) ABIExecutorPtr
Ret invokeSimcall(ThreadContext *tc, std::function< Ret(ThreadContext *, Args...)> target)
SyscallDescABI(int num, const char *name, ABIExecutorPtr< Args... > target)
SyscallDescABI(int num, const char *name, ABIExecutor< Args... > target)
std::function< SyscallReturn(SyscallDesc *, ThreadContext *, Args...)> ABIExecutor
SyscallDescTable(std::initializer_list< SyscallDescABI< ABI >> descs)
std::function< SyscallReturn(SyscallDesc *, ThreadContext *)> Executor
Executor executor
Mechanism for ISAs to connect to the emul function definitions.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
static Dumper buildDumper()
std::string _name
System call name (e.g., open, mmap, clone, socket, etc.)
void returnInto(ThreadContext *tc, const SyscallReturn &ret) override
For use within the system call executor if new threads are created and need something returned into t...
This class represents the return value from an emulated system call, including any errno setting.
void doSyscall(ThreadContext *tc)
Interface for invoking the system call funcion pointer.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
SyscallDesc(int num, const char *name, Executor exec, Dumper dump)
SyscallReturn unimplementedFunc(SyscallDesc *desc, ThreadContext *tc)
void dump()
Dump all statistics data to the registered outputs.
virtual void returnInto(ThreadContext *tc, const SyscallReturn &ret)=0
For use within the system call executor if new threads are created and need something returned into t...
SyscallDescABI(int num, const char *name)
static Executor buildExecutor(ABIExecutor< Args... > target)
SyscallDesc * get(int num, bool fatal_if_missing=true)
std::map< int, SyscallDescABI< ABI > > _descs
std::string dumpSimcall(std::string name, ThreadContext *tc, std::function< Ret(ThreadContext *, Args...)> target=std::function< Ret(ThreadContext *, Args...)>())
This class provides the wrapper interface for the system call implementations which are defined in th...
std::function< std::string(std::string, ThreadContext *)> Dumper
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17