summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <ericbunnie@gmail.com>2014-04-12 00:44:21 +0200
committerbunnei <ericbunnie@gmail.com>2014-04-12 00:44:21 +0200
commit02fbd42e7f006236199698c61ca917092afa1f7d (patch)
treeb60bd6801f624839dc80b53dffb523fa98b7b46f /src/core
parentreplace tabs with spaces (diff)
downloadyuzu-02fbd42e7f006236199698c61ca917092afa1f7d.tar
yuzu-02fbd42e7f006236199698c61ca917092afa1f7d.tar.gz
yuzu-02fbd42e7f006236199698c61ca917092afa1f7d.tar.bz2
yuzu-02fbd42e7f006236199698c61ca917092afa1f7d.tar.lz
yuzu-02fbd42e7f006236199698c61ca917092afa1f7d.tar.xz
yuzu-02fbd42e7f006236199698c61ca917092afa1f7d.tar.zst
yuzu-02fbd42e7f006236199698c61ca917092afa1f7d.zip
Diffstat (limited to '')
-rw-r--r--src/core/core.vcxproj5
-rw-r--r--src/core/core.vcxproj.filters12
-rw-r--r--src/core/hle/hle.cpp4
-rw-r--r--src/core/hle/hle_syscall.h37
-rw-r--r--src/core/hle/service/service.h60
-rw-r--r--src/core/hle/syscall.cpp (renamed from src/core/hle/hle_syscall.cpp)126
-rw-r--r--src/core/hle/syscall.h19
7 files changed, 157 insertions, 106 deletions
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index 89795ce63..10ecca596 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -153,7 +153,7 @@
<ClCompile Include="file_sys\directory_file_system.cpp" />
<ClCompile Include="file_sys\meta_file_system.cpp" />
<ClCompile Include="hle\hle.cpp" />
- <ClCompile Include="hle\hle_syscall.cpp" />
+ <ClCompile Include="hle\syscall.cpp" />
<ClCompile Include="hw\hw.cpp" />
<ClCompile Include="hw\hw_lcd.cpp" />
<ClCompile Include="loader.cpp" />
@@ -186,7 +186,8 @@
<ClInclude Include="file_sys\meta_file_system.h" />
<ClInclude Include="hle\function_wrappers.h" />
<ClInclude Include="hle\hle.h" />
- <ClInclude Include="hle\hle_syscall.h" />
+ <ClInclude Include="hle\service\service.h" />
+ <ClInclude Include="hle\syscall.h" />
<ClInclude Include="hw\hw.h" />
<ClInclude Include="hw\hw_lcd.h" />
<ClInclude Include="loader.h" />
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index eece5d486..d450224a4 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -25,6 +25,9 @@
<Filter Include="hle">
<UniqueIdentifier>{8b62769e-3e2a-4a57-a7bc-b3b2933c2bc7}</UniqueIdentifier>
</Filter>
+ <Filter Include="hle\service">
+ <UniqueIdentifier>{812c5189-ca49-4704-b842-3ffad09092d3}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="arm\disassembler\arm_disasm.cpp">
@@ -78,10 +81,10 @@
<ClCompile Include="mem_map_funcs.cpp" />
<ClCompile Include="system.cpp" />
<ClCompile Include="core_timing.cpp" />
- <ClCompile Include="hle\hle_syscall.cpp">
+ <ClCompile Include="hle\hle.cpp">
<Filter>hle</Filter>
</ClCompile>
- <ClCompile Include="hle\hle.cpp">
+ <ClCompile Include="hle\syscall.cpp">
<Filter>hle</Filter>
</ClCompile>
</ItemGroup>
@@ -163,7 +166,10 @@
<ClInclude Include="hle\function_wrappers.h">
<Filter>hle</Filter>
</ClInclude>
- <ClInclude Include="hle\hle_syscall.h">
+ <ClInclude Include="hle\service\service.h">
+ <Filter>hle\service</Filter>
+ </ClInclude>
+ <ClInclude Include="hle\syscall.h">
<Filter>hle</Filter>
</ClInclude>
</ItemGroup>
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index d62d2d0ce..32aff0eb5 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -5,7 +5,7 @@
#include <vector>
#include "core/hle/hle.h"
-#include "core/hle/hle_syscall.h"
+#include "core/hle/syscall.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -41,7 +41,7 @@ void RegisterModule(std::string name, int num_functions, const FunctionDef* func
}
void RegisterAllModules() {
- Register_Syscall();
+ Syscall::Register();
}
void Init() {
diff --git a/src/core/hle/hle_syscall.h b/src/core/hle/hle_syscall.h
deleted file mode 100644
index 80b20c358..000000000
--- a/src/core/hle/hle_syscall.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "common/common_types.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-//template <class T>
-//class KernelObject {
-//public:
-// virtual ~KernelObject() {}
-//
-// T GetNative() const {
-// return m_native;
-// }
-//
-// void SetNative(const T& native) {
-// m_native = native;
-// }
-//
-// virtual const char *GetTypeName() {return "[BAD KERNEL OBJECT TYPE]";}
-// virtual const char *GetName() {return "[UNKNOWN KERNEL OBJECT]";}
-//
-//private:
-// T m_native;
-//};
-
-//class Handle : public KernelObject<u32> {
-// const char* GetTypeName() {
-// return "Handle";
-// }
-//};
-
-void Register_Syscall();
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
new file mode 100644
index 000000000..f15099982
--- /dev/null
+++ b/src/core/hle/service/service.h
@@ -0,0 +1,60 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <string>
+
+#include "common/common_types.h"
+#include "core/hle/syscall.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Namespace Service
+
+namespace Service {
+
+typedef s32 NativeUID;
+
+/// Interface to a CTROS service
+class Interface {
+public:
+
+ virtual ~Interface() {
+ }
+
+ /**
+ * Gets the UID for the serice
+ * @return UID of service in native format
+ */
+ NativeUID GetUID() const {
+ return (NativeUID)m_uid;
+ }
+
+ /**
+ * Gets the string name used by CTROS for a service
+ * @return String name of service
+ */
+ virtual std::string GetName() {
+ return "[UNKNOWN SERVICE NAME]";
+ }
+
+ /**
+ * Gets the string name used by CTROS for a service
+ * @return Port name of service
+ */
+ virtual std::string GetPort() {
+ return "[UNKNOWN SERVICE PORT]";
+ }
+
+ /**
+ * Called when svcSendSyncRequest is called, loads command buffer and executes comand
+ * @return Return result of svcSendSyncRequest passed back to user app
+ */
+ virtual Syscall::Result Sync() = 0;
+
+private:
+ u32 m_uid;
+};
+
+} // namespace
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/syscall.cpp
index 92d9b0c85..98155dc8e 100644
--- a/src/core/hle/hle_syscall.cpp
+++ b/src/core/hle/syscall.cpp
@@ -2,15 +2,15 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
+#include <map>
+
#include "core/hle/function_wrappers.h"
-#include "core/hle/hle_syscall.h"
+#include "core/hle/syscall.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
+// Namespace Syscall
-typedef u32 Handle;
-typedef s32 Result;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
+namespace Syscall {
Result SVC_ConnectToPort(void* out, const char* port_name) {
NOTICE_LOG(OSHLE, "svcConnectToPort called, port_name: %s", port_name);
@@ -64,23 +64,23 @@ const HLE::FunctionDef Syscall_Table[] = {
{0x2B, NULL, "svcGetProcessInfo"},
{0x2C, NULL, "svcGetThreadInfo"},
{0x2D, WrapI_VC<SVC_ConnectToPort>, "svcConnectToPort"},
- {0x2E NULL, "svcSendSyncRequest1"},
- {0x2F NULL, "svcSendSyncRequest2"},
- {0x30 NULL, "svcSendSyncRequest3"},
- {0x31 NULL, "svcSendSyncRequest4"},
- {0x32 NULL, "svcSendSyncRequest"},
- {0x33 NULL, "svcOpenProcess"},
- {0x34 NULL, "svcOpenThread"},
- {0x35 NULL, "svcGetProcessId"},
- {0x36 NULL, "svcGetProcessIdOfThread"},
- {0x37 NULL, "svcGetThreadId"},
- {0x38 NULL, "svcGetResourceLimit"},
- {0x39 NULL, "svcGetResourceLimitLimitValues"},
- {0x3A NULL, "svcGetResourceLimitCurrentValues"},
- {0x3B NULL, "svcGetThreadContext"},
- {0x3C NULL, "svcBreak"},
- {0x3D NULL, "svcOutputDebugString"},
- {0x3E NULL, "svcControlPerformanceCounter"},
+ {0x2E, NULL, "svcSendSyncRequest1"},
+ {0x2F, NULL, "svcSendSyncRequest2"},
+ {0x30, NULL, "svcSendSyncRequest3"},
+ {0x31, NULL, "svcSendSyncRequest4"},
+ {0x32, NULL, "svcSendSyncRequest"},
+ {0x33, NULL, "svcOpenProcess"},
+ {0x34, NULL, "svcOpenThread"},
+ {0x35, NULL, "svcGetProcessId"},
+ {0x36, NULL, "svcGetProcessIdOfThread"},
+ {0x37, NULL, "svcGetThreadId"},
+ {0x38, NULL, "svcGetResourceLimit"},
+ {0x39, NULL, "svcGetResourceLimitLimitValues"},
+ {0x3A, NULL, "svcGetResourceLimitCurrentValues"},
+ {0x3B, NULL, "svcGetThreadContext"},
+ {0x3C, NULL, "svcBreak"},
+ {0x3D, NULL, "svcOutputDebugString"},
+ {0x3E, NULL, "svcControlPerformanceCounter"},
{0x3F, NULL, "Unknown"},
{0x40, NULL, "Unknown"},
{0x41, NULL, "Unknown"},
@@ -89,24 +89,24 @@ const HLE::FunctionDef Syscall_Table[] = {
{0x44, NULL, "Unknown"},
{0x45, NULL, "Unknown"},
{0x46, NULL, "Unknown"},
- {0x47 NULL, "svcCreatePort"},
- {0x48 NULL, "svcCreateSessionToPort"},
- {0x49 NULL, "svcCreateSession"},
- {0x4A NULL, "svcAcceptSession"},
- {0x4B NULL, "svcReplyAndReceive1"},
- {0x4C NULL, "svcReplyAndReceive2"},
- {0x4D NULL, "svcReplyAndReceive3"},
- {0x4E NULL, "svcReplyAndReceive4"},
- {0x4F NULL, "svcReplyAndReceive"},
- {0x50 NULL, "svcBindInterrupt"},
- {0x51 NULL, "svcUnbindInterrupt"},
- {0x52 NULL, "svcInvalidateProcessDataCache"},
- {0x53 NULL, "svcStoreProcessDataCache"},
- {0x54 NULL, "svcFlushProcessDataCache"},
- {0x55 NULL, "svcStartInterProcessDma"},
- {0x56 NULL, "svcStopDma"},
- {0x57 NULL, "svcGetDmaState"},
- {0x58 NULL, "svcRestartDma"},
+ {0x47, NULL, "svcCreatePort"},
+ {0x48, NULL, "svcCreateSessionToPort"},
+ {0x49, NULL, "svcCreateSession"},
+ {0x4A, NULL, "svcAcceptSession"},
+ {0x4B, NULL, "svcReplyAndReceive1"},
+ {0x4C, NULL, "svcReplyAndReceive2"},
+ {0x4D, NULL, "svcReplyAndReceive3"},
+ {0x4E, NULL, "svcReplyAndReceive4"},
+ {0x4F, NULL, "svcReplyAndReceive"},
+ {0x50, NULL, "svcBindInterrupt"},
+ {0x51, NULL, "svcUnbindInterrupt"},
+ {0x52, NULL, "svcInvalidateProcessDataCache"},
+ {0x53, NULL, "svcStoreProcessDataCache"},
+ {0x54, NULL, "svcFlushProcessDataCache"},
+ {0x55, NULL, "svcStartInterProcessDma"},
+ {0x56, NULL, "svcStopDma"},
+ {0x57, NULL, "svcGetDmaState"},
+ {0x58, NULL, "svcRestartDma"},
{0x59, NULL, "Unknown"},
{0x5A, NULL, "Unknown"},
{0x5B, NULL, "Unknown"},
@@ -114,38 +114,40 @@ const HLE::FunctionDef Syscall_Table[] = {
{0x5D, NULL, "Unknown"},
{0x5E, NULL, "Unknown"},
{0x5F, NULL, "Unknown"},
- {0x60 NULL, "svcDebugActiveProcess"},
- {0x61 NULL, "svcBreakDebugProcess"},
- {0x62 NULL, "svcTerminateDebugProcess"},
- {0x63 NULL, "svcGetProcessDebugEvent"},
- {0x64 NULL, "svcContinueDebugEvent"},
- {0x65 NULL, "svcGetProcessList"},
- {0x66 NULL, "svcGetThreadList"},
- {0x67 NULL, "svcGetDebugThreadContext"},
- {0x68 NULL, "svcSetDebugThreadContext"},
- {0x69 NULL, "svcQueryDebugProcessMemory"},
- {0x6A NULL, "svcReadProcessMemory"},
- {0x6B NULL, "svcWriteProcessMemory"},
- {0x6C NULL, "svcSetHardwareBreakPoint"},
- {0x6D NULL, "svcGetDebugThreadParam"},
+ {0x60, NULL, "svcDebugActiveProcess"},
+ {0x61, NULL, "svcBreakDebugProcess"},
+ {0x62, NULL, "svcTerminateDebugProcess"},
+ {0x63, NULL, "svcGetProcessDebugEvent"},
+ {0x64, NULL, "svcContinueDebugEvent"},
+ {0x65, NULL, "svcGetProcessList"},
+ {0x66, NULL, "svcGetThreadList"},
+ {0x67, NULL, "svcGetDebugThreadContext"},
+ {0x68, NULL, "svcSetDebugThreadContext"},
+ {0x69, NULL, "svcQueryDebugProcessMemory"},
+ {0x6A, NULL, "svcReadProcessMemory"},
+ {0x6B, NULL, "svcWriteProcessMemory"},
+ {0x6C, NULL, "svcSetHardwareBreakPoint"},
+ {0x6D, NULL, "svcGetDebugThreadParam"},
{0x6E, NULL, "Unknown"},
{0x6F, NULL, "Unknown"},
- {0x70 NULL, "svcControlProcessMemory"},
- {0x71 NULL, "svcMapProcessMemory"},
- {0x72 NULL, "svcUnmapProcessMemory"},
+ {0x70, NULL, "svcControlProcessMemory"},
+ {0x71, NULL, "svcMapProcessMemory"},
+ {0x72, NULL, "svcUnmapProcessMemory"},
{0x73, NULL, "Unknown"},
{0x74, NULL, "Unknown"},
{0x75, NULL, "Unknown"},
- {0x76 NULL, "svcTerminateProcess"},
+ {0x76, NULL, "svcTerminateProcess"},
{0x77, NULL, "Unknown"},
- {0x78 NULL, "svcCreateResourceLimit"},
+ {0x78, NULL, "svcCreateResourceLimit"},
{0x79, NULL, "Unknown"},
{0x7A, NULL, "Unknown"},
{0x7B, NULL, "Unknown"},
- {0x7C NULL, "svcKernelSetState"},
- {0x7D NULL, "svcQueryProcessMemory"},
+ {0x7C, NULL, "svcKernelSetState"},
+ {0x7D, NULL, "svcQueryProcessMemory"},
};
-void Register_Syscall() {
+void Register() {
HLE::RegisterModule("SyscallTable", ARRAY_SIZE(Syscall_Table), Syscall_Table);
}
+
+} // namespace
diff --git a/src/core/hle/syscall.h b/src/core/hle/syscall.h
new file mode 100644
index 000000000..7a94e0136
--- /dev/null
+++ b/src/core/hle/syscall.h
@@ -0,0 +1,19 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Namespace Syscall
+
+namespace Syscall {
+
+typedef u32 Handle;
+typedef s32 Result;
+
+void Register();
+
+} // namespace