Add a couple of useful SVC logs

This commit is contained in:
Hamish Milne 2020-04-11 19:47:06 +01:00
parent 3871d74bc2
commit e6b40486c5
2 changed files with 21 additions and 0 deletions

View file

@ -1607,6 +1607,7 @@ void SVC::CallSVC(u32 immediate) {
"Running threads from exiting processes is unimplemented");
const FunctionDef* info = GetSVCInfo(immediate);
LOG_TRACE(Kernel_SVC, "calling {}", info->name);
if (info) {
if (info->func) {
(this->*(info->func))();

View file

@ -280,6 +280,26 @@ private:
}
};
template <typename SVCT>
struct WrapPass<SVCT, ResultCode /*empty for T, Ts...*/> {
// Call function R(Context::svc)(Us...) and transfer the return value to registers
template <typename... Us>
static void Call(Context& context, SVCT svc, Us... u) {
static_assert(std::is_same_v<SVCT, ResultCode (Context::*)(Us...)>);
if constexpr (std::is_void_v<ResultCode>) {
(context.*svc)(u...);
} else {
ResultCode r = (context.*svc)(u...);
if (r.IsError()) {
LOG_ERROR(Kernel_SVC, "level={} summary={} module={} description={}",
r.level.ExtractValue(r.raw), r.summary.ExtractValue(r.raw),
r.module.ExtractValue(r.raw), r.description.ExtractValue(r.raw));
}
SetParam<INDEX_RETURN, ResultCode, ResultCode, Us...>(context, r);
}
}
};
template <typename T>
struct WrapHelper;