diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-06 05:04:25 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-05-06 05:24:39 +0200 |
commit | ecff2351a180e76967de7322ceb2d8e9064ae7a6 (patch) | |
tree | 0707ce5701d0c996a3ee131542e0f2178ba6e48e /src/core/hle/svc.cpp | |
parent | Merge pull request #719 from yuriks/unused-stuff (diff) | |
download | yuzu-ecff2351a180e76967de7322ceb2d8e9064ae7a6.tar yuzu-ecff2351a180e76967de7322ceb2d8e9064ae7a6.tar.gz yuzu-ecff2351a180e76967de7322ceb2d8e9064ae7a6.tar.bz2 yuzu-ecff2351a180e76967de7322ceb2d8e9064ae7a6.tar.lz yuzu-ecff2351a180e76967de7322ceb2d8e9064ae7a6.tar.xz yuzu-ecff2351a180e76967de7322ceb2d8e9064ae7a6.tar.zst yuzu-ecff2351a180e76967de7322ceb2d8e9064ae7a6.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/svc.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 76e9b171a..2da488d83 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -4,6 +4,7 @@ #include <map> +#include "common/profiler.h" #include "common/string_util.h" #include "common/symbols.h" @@ -606,7 +607,17 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32 return RESULT_SUCCESS; } -const HLE::FunctionDef SVC_Table[] = { +namespace { + struct FunctionDef { + using Func = void(); + + u32 id; + Func* func; + const char* name; + }; +} + +static const FunctionDef SVC_Table[] = { {0x00, nullptr, "Unknown"}, {0x01, HLE::Wrap<ControlMemory>, "ControlMemory"}, {0x02, HLE::Wrap<QueryMemory>, "QueryMemory"}, @@ -735,8 +746,28 @@ const HLE::FunctionDef SVC_Table[] = { {0x7D, nullptr, "QueryProcessMemory"}, }; -void Register() { - HLE::RegisterModule("SVC_Table", ARRAY_SIZE(SVC_Table), SVC_Table); +Common::Profiling::TimingCategory profiler_svc("SVC Calls"); + +static const FunctionDef* GetSVCInfo(u32 opcode) { + u32 func_num = opcode & 0xFFFFFF; // 8 bits + if (func_num >= ARRAY_SIZE(SVC_Table)) { + LOG_ERROR(Kernel_SVC, "unknown svc=0x%02X", func_num); + return nullptr; + } + return &SVC_Table[func_num]; +} + +void CallSVC(u32 opcode) { + Common::Profiling::ScopeTimer timer_svc(profiler_svc); + + const FunctionDef *info = GetSVCInfo(opcode); + if (info) { + if (info->func) { + info->func(); + } else { + LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name); + } + } } } // namespace |