Go to the documentation of this file.
42 #ifndef __SIM_SYSCALL_DESC_HH__
43 #define __SIM_SYSCALL_DESC_HH__
113 template <
typename ABI>
118 template <
typename ...Args>
122 template <
typename ...Args>
129 template <
typename ...Args>
137 auto partial = [target,desc](
139 return target(desc, tc, args...);
150 template <
typename ...Args>
161 template <
typename ...Args>
167 template <
typename ...Args>
183 template <
typename ABI>
187 std::map<int, SyscallDescABI<ABI>>
_descs;
192 for (
auto &desc: descs) {
193 auto res =
_descs.insert({desc.num(), desc});
194 panic_if(!res.second,
"Failed to insert desc %s", desc.name());
199 *
get(
int num,
bool fatal_if_missing=
true)
201 auto it =
_descs.find(num);
203 if (fatal_if_missing)
204 fatal(
"Syscall %d out of range", num);
214 #endif // __SIM_SYSCALL_DESC_HH__
#define fatal(...)
This implements a cprintf based fatal() function.
std::map< int, SyscallDescABI< ABI > > _descs
This class represents the return value from an emulated system call, including any errno setting.
static Dumper buildDumper()
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...
Executor executor
Mechanism for ISAs to connect to the emul function definitions.
void doSyscall(ThreadContext *tc)
Interface for invoking the system call funcion pointer.
std::function< std::string(std::string, ThreadContext *)> Dumper
SyscallDescABI(int num, const char *name, ABIExecutor< Args... > target)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
SyscallDesc(int num, const char *name, Executor exec, Dumper dump)
std::string dumpSimcall(std::string name, ThreadContext *tc, std::function< Ret(ThreadContext *, Args...)> target=std::function< Ret(ThreadContext *, Args...)>())
std::function< SyscallReturn(SyscallDesc *, ThreadContext *, Args...)> ABIExecutor
void dump()
Dump all statistics data to the registered outputs.
SyscallReturn(*)(SyscallDesc *, ThreadContext *, Args...) ABIExecutorPtr
static Executor buildExecutor(ABIExecutor< Args... > target)
SyscallDescABI(int num, const char *name)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
std::string _name
System call name (e.g., open, mmap, clone, socket, etc.)
std::function< SyscallReturn(SyscallDesc *, ThreadContext *)> Executor
SyscallDesc * get(int num, bool fatal_if_missing=true)
This class provides the wrapper interface for the system call implementations which are defined in th...
SyscallDescTable(std::initializer_list< SyscallDescABI< ABI >> descs)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Ret invokeSimcall(ThreadContext *tc, std::function< Ret(ThreadContext *, Args...)> target)
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...
SyscallDescABI(int num, const char *name, ABIExecutorPtr< Args... > target)
SyscallReturn unimplementedFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we haven't thought about.
Generated on Wed Jul 28 2021 12:10:29 for gem5 by doxygen 1.8.17