Go to the documentation of this file.
42 #ifndef __SIM_SYSCALL_DESC_HH__
43 #define __SIM_SYSCALL_DESC_HH__
118 template <
typename ABI>
123 template <
typename ...Args>
127 template <
typename ...Args>
134 template <
typename ...Args>
142 auto partial = [target,desc](
144 return target(desc, tc, args...);
155 template <
typename ...Args>
166 template <
typename ...Args>
172 template <
typename ...Args>
188 template <
typename ABI>
192 std::map<int, SyscallDescABI<ABI>>
_descs;
197 for (
auto &desc: descs) {
198 auto res =
_descs.insert({desc.num(), desc});
199 panic_if(!res.second,
"Failed to insert desc %s", desc.name());
204 *
get(
int num,
bool fatal_if_missing=
true)
206 auto it =
_descs.find(num);
208 if (fatal_if_missing)
209 fatal(
"Syscall %d out of range", num);
219 #endif // __SIM_SYSCALL_DESC_HH__
void retrySyscall(ThreadContext *tc)
#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)
void setupRetry(ThreadContext *tc)
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)
void handleReturn(ThreadContext *tc, const SyscallReturn &ret)
#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 Sun Jul 30 2023 01:57:00 for gem5 by doxygen 1.8.17