- renamed hle_syscall to just syscall

- added service.h as an initial service interface
merge-requests/60/head
bunnei 2014-04-11 18:44:21 +07:00
parent 7ea7585898
commit 02fbd42e7f
7 changed files with 157 additions and 106 deletions

@ -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" />

@ -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>

@ -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() {

@ -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();

@ -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

@ -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

@ -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