summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-05-06 05:04:25 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-05-06 05:24:39 +0200
commitecff2351a180e76967de7322ceb2d8e9064ae7a6 (patch)
tree0707ce5701d0c996a3ee131542e0f2178ba6e48e /src/core/hle
parentMerge pull request #719 from yuriks/unused-stuff (diff)
downloadyuzu-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 'src/core/hle')
-rw-r--r--src/core/hle/hle.cpp49
-rw-r--r--src/core/hle/hle.h27
-rw-r--r--src/core/hle/svc.cpp37
-rw-r--r--src/core/hle/svc.h2
4 files changed, 38 insertions, 77 deletions
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index 191d0411e..fdeb9a028 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -2,53 +2,23 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <vector>
-
-#include "common/profiler.h"
+#include "common/assert.h"
+#include "common/logging/log.h"
#include "core/arm/arm_interface.h"
-#include "core/mem_map.h"
+#include "core/core.h"
#include "core/hle/hle.h"
#include "core/hle/config_mem.h"
#include "core/hle/shared_page.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/service/service.h"
-#include "core/hle/svc.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace HLE {
-Common::Profiling::TimingCategory profiler_svc("SVC Calls");
-
-static std::vector<ModuleDef> g_module_db;
-
bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread
-static const FunctionDef* GetSVCInfo(u32 opcode) {
- u32 func_num = opcode & 0xFFFFFF; // 8 bits
- if (func_num > 0xFF) {
- LOG_ERROR(Kernel_SVC,"unknown svc=0x%02X", func_num);
- return nullptr;
- }
- return &g_module_db[0].func_table[func_num];
-}
-
-void CallSVC(u32 opcode) {
- Common::Profiling::ScopeTimer timer_svc(profiler_svc);
-
- const FunctionDef *info = GetSVCInfo(opcode);
-
- if (!info) {
- return;
- }
- if (info->func) {
- info->func();
- } else {
- LOG_ERROR(Kernel_SVC, "unimplemented SVC function %s(..)", info->name.c_str());
- }
-}
-
void Reschedule(const char *reason) {
DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
@@ -63,18 +33,7 @@ void Reschedule(const char *reason) {
g_reschedule = true;
}
-void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
- ModuleDef module = {name, num_functions, func_table};
- g_module_db.push_back(module);
-}
-
-static void RegisterAllModules() {
- SVC::Register();
-}
-
void Init() {
- RegisterAllModules();
-
Service::Init();
ConfigMem::Init();
SharedPage::Init();
@@ -89,8 +48,6 @@ void Shutdown() {
SharedPage::Shutdown();
Service::Shutdown();
- g_module_db.clear();
-
LOG_DEBUG(Kernel, "shutdown OK");
}
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index 3f6f9a4b5..23de1aab7 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -4,40 +4,13 @@
#pragma once
-#include <string>
-
-#include "common/common_types.h"
-#include "core/core.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
namespace HLE {
extern bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread
-typedef u32 Addr;
-typedef void (*Func)();
-
-struct FunctionDef {
- u32 id;
- Func func;
- std::string name;
-};
-
-struct ModuleDef {
- std::string name;
- int num_funcs;
- const FunctionDef* func_table;
-};
-
-void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table);
-
-void CallSVC(u32 opcode);
-
void Reschedule(const char *reason);
void Init();
-
void Shutdown();
} // namespace
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
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h
index 5d020a5ba..4389aa73d 100644
--- a/src/core/hle/svc.h
+++ b/src/core/hle/svc.h
@@ -41,6 +41,6 @@ enum ArbitrationType {
namespace SVC {
-void Register();
+void CallSVC(u32 opcode);
} // namespace