28 #ifndef __SIM_GUEST_ABI_DISPATCH_HH__ 29 #define __SIM_GUEST_ABI_DISPATCH_HH__ 33 #include <type_traits> 55 template <
typename ABI,
bool store_ret,
typename Ret>
56 static typename std::enable_if<!std::is_void<Ret>::value && store_ret,
62 storeResult<ABI, Ret>(tc, ret, state);
66 template <
typename ABI,
bool store_ret,
typename Ret>
67 static typename std::enable_if<!std::is_void<Ret>::value && !store_ret,
76 template <
typename ABI>
86 template <
typename ABI,
bool store_ret,
typename Ret,
87 typename NextArg,
typename ...Args>
88 static typename std::enable_if<!std::is_void<Ret>::value, Ret>
::type 93 NextArg next = getArgument<ABI, NextArg>(tc, state);
98 return target(_tc, next, args...);
102 return callFrom<ABI, store_ret, Ret, Args...>(tc, state, partial);
107 template <
typename ABI,
typename NextArg,
typename ...Args>
110 std::function<
void(
ThreadContext *, NextArg, Args...)> target)
113 NextArg next = getArgument<ABI, NextArg>(tc, state);
118 target(_tc, next, args...);
122 callFrom<ABI, Args...>(tc, state, partial);
133 template <
typename ABI,
typename Ret>
136 typename ABI::State &state)
144 template <
typename ABI,
typename Ret,
typename NextArg,
typename ...Args>
147 typename ABI::State &state)
151 os << (count ?
", " :
"(");
154 NextArg next = getArgument<ABI, NextArg>(tc, state);
165 #endif // __SIM_GUEST_ABI_DISPATCH_HH__
static void dumpArgsFrom(int count, std::ostream &os, ThreadContext *tc, typename ABI::State &state)
static std::enable_if<!std::is_void< Ret >::value &&store_ret, Ret >::type callFrom(ThreadContext *tc, typename ABI::State &state, std::function< Ret(ThreadContext *)> target)
ThreadContext is the external interface to all thread state for anything outside of the CPU...