|
|
|
@ -81,7 +81,7 @@ Result ConnectToPort(void* _out, const char* port_name) {
|
|
|
|
|
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG(SVC, "called port_name=%s", port_name);
|
|
|
|
|
_assert_msg_(KERNEL, (service != NULL), "called, but service is not implemented!");
|
|
|
|
|
_assert_msg_(KERNEL, (service != nullptr), "called, but service is not implemented!");
|
|
|
|
|
|
|
|
|
|
*out = service->GetHandle();
|
|
|
|
|
|
|
|
|
@ -93,7 +93,7 @@ Result SendSyncRequest(Handle handle) {
|
|
|
|
|
bool wait = false;
|
|
|
|
|
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
|
|
|
|
|
|
|
|
|
|
_assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!");
|
|
|
|
|
_assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
|
|
|
|
|
DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName());
|
|
|
|
|
|
|
|
|
|
Result res = object->SyncRequest(&wait);
|
|
|
|
@ -122,7 +122,7 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
|
|
|
|
|
DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%d", handle, object->GetTypeName(),
|
|
|
|
|
object->GetName(), nano_seconds);
|
|
|
|
|
|
|
|
|
|
_assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!");
|
|
|
|
|
_assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
|
|
|
|
|
|
|
|
|
|
Result res = object->WaitSynchronization(&wait);
|
|
|
|
|
|
|
|
|
@ -152,8 +152,8 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa
|
|
|
|
|
bool wait = false;
|
|
|
|
|
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]);
|
|
|
|
|
|
|
|
|
|
_assert_msg_(KERNEL, (object != NULL), "called handle=0x%08X, but kernel object "
|
|
|
|
|
"is NULL!", handles[i]);
|
|
|
|
|
_assert_msg_(KERNEL, (object != nullptr), "called handle=0x%08X, but kernel object "
|
|
|
|
|
"is nullptr!", handles[i]);
|
|
|
|
|
|
|
|
|
|
DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName(),
|
|
|
|
|
object->GetName());
|
|
|
|
@ -278,7 +278,7 @@ Result CreateMutex(void* _mutex, u32 initial_locked) {
|
|
|
|
|
/// Release a mutex
|
|
|
|
|
Result ReleaseMutex(Handle handle) {
|
|
|
|
|
DEBUG_LOG(SVC, "called handle=0x%08X", handle);
|
|
|
|
|
_assert_msg_(KERNEL, (handle != 0), "called, but handle is NULL!");
|
|
|
|
|
_assert_msg_(KERNEL, (handle != 0), "called, but handle is nullptr!");
|
|
|
|
|
Kernel::ReleaseMutex(handle);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -342,132 +342,132 @@ void SleepThread(s64 nanoseconds) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const HLE::FunctionDef SVC_Table[] = {
|
|
|
|
|
{0x00, NULL, "Unknown"},
|
|
|
|
|
{0x00, nullptr, "Unknown"},
|
|
|
|
|
{0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"},
|
|
|
|
|
{0x02, WrapI_VVU<QueryMemory>, "QueryMemory"},
|
|
|
|
|
{0x03, NULL, "ExitProcess"},
|
|
|
|
|
{0x04, NULL, "GetProcessAffinityMask"},
|
|
|
|
|
{0x05, NULL, "SetProcessAffinityMask"},
|
|
|
|
|
{0x06, NULL, "GetProcessIdealProcessor"},
|
|
|
|
|
{0x07, NULL, "SetProcessIdealProcessor"},
|
|
|
|
|
{0x03, nullptr, "ExitProcess"},
|
|
|
|
|
{0x04, nullptr, "GetProcessAffinityMask"},
|
|
|
|
|
{0x05, nullptr, "SetProcessAffinityMask"},
|
|
|
|
|
{0x06, nullptr, "GetProcessIdealProcessor"},
|
|
|
|
|
{0x07, nullptr, "SetProcessIdealProcessor"},
|
|
|
|
|
{0x08, WrapI_UUUUU<CreateThread>, "CreateThread"},
|
|
|
|
|
{0x09, WrapU_V<ExitThread>, "ExitThread"},
|
|
|
|
|
{0x0A, WrapV_S64<SleepThread>, "SleepThread"},
|
|
|
|
|
{0x0B, WrapI_VU<GetThreadPriority>, "GetThreadPriority"},
|
|
|
|
|
{0x0C, WrapI_UI<SetThreadPriority>, "SetThreadPriority"},
|
|
|
|
|
{0x0D, NULL, "GetThreadAffinityMask"},
|
|
|
|
|
{0x0E, NULL, "SetThreadAffinityMask"},
|
|
|
|
|
{0x0F, NULL, "GetThreadIdealProcessor"},
|
|
|
|
|
{0x10, NULL, "SetThreadIdealProcessor"},
|
|
|
|
|
{0x11, NULL, "GetCurrentProcessorNumber"},
|
|
|
|
|
{0x12, NULL, "Run"},
|
|
|
|
|
{0x0D, nullptr, "GetThreadAffinityMask"},
|
|
|
|
|
{0x0E, nullptr, "SetThreadAffinityMask"},
|
|
|
|
|
{0x0F, nullptr, "GetThreadIdealProcessor"},
|
|
|
|
|
{0x10, nullptr, "SetThreadIdealProcessor"},
|
|
|
|
|
{0x11, nullptr, "GetCurrentProcessorNumber"},
|
|
|
|
|
{0x12, nullptr, "Run"},
|
|
|
|
|
{0x13, WrapI_VU<CreateMutex>, "CreateMutex"},
|
|
|
|
|
{0x14, WrapI_U<ReleaseMutex>, "ReleaseMutex"},
|
|
|
|
|
{0x15, NULL, "CreateSemaphore"},
|
|
|
|
|
{0x16, NULL, "ReleaseSemaphore"},
|
|
|
|
|
{0x15, nullptr, "CreateSemaphore"},
|
|
|
|
|
{0x16, nullptr, "ReleaseSemaphore"},
|
|
|
|
|
{0x17, WrapI_VU<CreateEvent>, "CreateEvent"},
|
|
|
|
|
{0x18, WrapI_U<SignalEvent>, "SignalEvent"},
|
|
|
|
|
{0x19, WrapI_U<ClearEvent>, "ClearEvent"},
|
|
|
|
|
{0x1A, NULL, "CreateTimer"},
|
|
|
|
|
{0x1B, NULL, "SetTimer"},
|
|
|
|
|
{0x1C, NULL, "CancelTimer"},
|
|
|
|
|
{0x1D, NULL, "ClearTimer"},
|
|
|
|
|
{0x1E, NULL, "CreateMemoryBlock"},
|
|
|
|
|
{0x1A, nullptr, "CreateTimer"},
|
|
|
|
|
{0x1B, nullptr, "SetTimer"},
|
|
|
|
|
{0x1C, nullptr, "CancelTimer"},
|
|
|
|
|
{0x1D, nullptr, "ClearTimer"},
|
|
|
|
|
{0x1E, nullptr, "CreateMemoryBlock"},
|
|
|
|
|
{0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"},
|
|
|
|
|
{0x20, NULL, "UnmapMemoryBlock"},
|
|
|
|
|
{0x20, nullptr, "UnmapMemoryBlock"},
|
|
|
|
|
{0x21, WrapI_V<CreateAddressArbiter>, "CreateAddressArbiter"},
|
|
|
|
|
{0x22, WrapI_UUUUS64<ArbitrateAddress>, "ArbitrateAddress"},
|
|
|
|
|
{0x23, WrapI_U<CloseHandle>, "CloseHandle"},
|
|
|
|
|
{0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"},
|
|
|
|
|
{0x25, WrapI_VVUUS64<WaitSynchronizationN>, "WaitSynchronizationN"},
|
|
|
|
|
{0x26, NULL, "SignalAndWait"},
|
|
|
|
|
{0x26, nullptr, "SignalAndWait"},
|
|
|
|
|
{0x27, WrapI_VU<DuplicateHandle>, "DuplicateHandle"},
|
|
|
|
|
{0x28, NULL, "GetSystemTick"},
|
|
|
|
|
{0x29, NULL, "GetHandleInfo"},
|
|
|
|
|
{0x2A, NULL, "GetSystemInfo"},
|
|
|
|
|
{0x2B, NULL, "GetProcessInfo"},
|
|
|
|
|
{0x2C, NULL, "GetThreadInfo"},
|
|
|
|
|
{0x28, nullptr, "GetSystemTick"},
|
|
|
|
|
{0x29, nullptr, "GetHandleInfo"},
|
|
|
|
|
{0x2A, nullptr, "GetSystemInfo"},
|
|
|
|
|
{0x2B, nullptr, "GetProcessInfo"},
|
|
|
|
|
{0x2C, nullptr, "GetThreadInfo"},
|
|
|
|
|
{0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"},
|
|
|
|
|
{0x2E, NULL, "SendSyncRequest1"},
|
|
|
|
|
{0x2F, NULL, "SendSyncRequest2"},
|
|
|
|
|
{0x30, NULL, "SendSyncRequest3"},
|
|
|
|
|
{0x31, NULL, "SendSyncRequest4"},
|
|
|
|
|
{0x2E, nullptr, "SendSyncRequest1"},
|
|
|
|
|
{0x2F, nullptr, "SendSyncRequest2"},
|
|
|
|
|
{0x30, nullptr, "SendSyncRequest3"},
|
|
|
|
|
{0x31, nullptr, "SendSyncRequest4"},
|
|
|
|
|
{0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"},
|
|
|
|
|
{0x33, NULL, "OpenProcess"},
|
|
|
|
|
{0x34, NULL, "OpenThread"},
|
|
|
|
|
{0x35, NULL, "GetProcessId"},
|
|
|
|
|
{0x36, NULL, "GetProcessIdOfThread"},
|
|
|
|
|
{0x33, nullptr, "OpenProcess"},
|
|
|
|
|
{0x34, nullptr, "OpenThread"},
|
|
|
|
|
{0x35, nullptr, "GetProcessId"},
|
|
|
|
|
{0x36, nullptr, "GetProcessIdOfThread"},
|
|
|
|
|
{0x37, WrapI_VU<GetThreadId>, "GetThreadId"},
|
|
|
|
|
{0x38, WrapI_VU<GetResourceLimit>, "GetResourceLimit"},
|
|
|
|
|
{0x39, NULL, "GetResourceLimitLimitValues"},
|
|
|
|
|
{0x39, nullptr, "GetResourceLimitLimitValues"},
|
|
|
|
|
{0x3A, WrapI_VUVI<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"},
|
|
|
|
|
{0x3B, NULL, "GetThreadContext"},
|
|
|
|
|
{0x3C, NULL, "Break"},
|
|
|
|
|
{0x3B, nullptr, "GetThreadContext"},
|
|
|
|
|
{0x3C, nullptr, "Break"},
|
|
|
|
|
{0x3D, WrapV_C<OutputDebugString>, "OutputDebugString"},
|
|
|
|
|
{0x3E, NULL, "ControlPerformanceCounter"},
|
|
|
|
|
{0x3F, NULL, "Unknown"},
|
|
|
|
|
{0x40, NULL, "Unknown"},
|
|
|
|
|
{0x41, NULL, "Unknown"},
|
|
|
|
|
{0x42, NULL, "Unknown"},
|
|
|
|
|
{0x43, NULL, "Unknown"},
|
|
|
|
|
{0x44, NULL, "Unknown"},
|
|
|
|
|
{0x45, NULL, "Unknown"},
|
|
|
|
|
{0x46, NULL, "Unknown"},
|
|
|
|
|
{0x47, NULL, "CreatePort"},
|
|
|
|
|
{0x48, NULL, "CreateSessionToPort"},
|
|
|
|
|
{0x49, NULL, "CreateSession"},
|
|
|
|
|
{0x4A, NULL, "AcceptSession"},
|
|
|
|
|
{0x4B, NULL, "ReplyAndReceive1"},
|
|
|
|
|
{0x4C, NULL, "ReplyAndReceive2"},
|
|
|
|
|
{0x4D, NULL, "ReplyAndReceive3"},
|
|
|
|
|
{0x4E, NULL, "ReplyAndReceive4"},
|
|
|
|
|
{0x4F, NULL, "ReplyAndReceive"},
|
|
|
|
|
{0x50, NULL, "BindInterrupt"},
|
|
|
|
|
{0x51, NULL, "UnbindInterrupt"},
|
|
|
|
|
{0x52, NULL, "InvalidateProcessDataCache"},
|
|
|
|
|
{0x53, NULL, "StoreProcessDataCache"},
|
|
|
|
|
{0x54, NULL, "FlushProcessDataCache"},
|
|
|
|
|
{0x55, NULL, "StartInterProcessDma"},
|
|
|
|
|
{0x56, NULL, "StopDma"},
|
|
|
|
|
{0x57, NULL, "GetDmaState"},
|
|
|
|
|
{0x58, NULL, "RestartDma"},
|
|
|
|
|
{0x59, NULL, "Unknown"},
|
|
|
|
|
{0x5A, NULL, "Unknown"},
|
|
|
|
|
{0x5B, NULL, "Unknown"},
|
|
|
|
|
{0x5C, NULL, "Unknown"},
|
|
|
|
|
{0x5D, NULL, "Unknown"},
|
|
|
|
|
{0x5E, NULL, "Unknown"},
|
|
|
|
|
{0x5F, NULL, "Unknown"},
|
|
|
|
|
{0x60, NULL, "DebugActiveProcess"},
|
|
|
|
|
{0x61, NULL, "BreakDebugProcess"},
|
|
|
|
|
{0x62, NULL, "TerminateDebugProcess"},
|
|
|
|
|
{0x63, NULL, "GetProcessDebugEvent"},
|
|
|
|
|
{0x64, NULL, "ContinueDebugEvent"},
|
|
|
|
|
{0x65, NULL, "GetProcessList"},
|
|
|
|
|
{0x66, NULL, "GetThreadList"},
|
|
|
|
|
{0x67, NULL, "GetDebugThreadContext"},
|
|
|
|
|
{0x68, NULL, "SetDebugThreadContext"},
|
|
|
|
|
{0x69, NULL, "QueryDebugProcessMemory"},
|
|
|
|
|
{0x6A, NULL, "ReadProcessMemory"},
|
|
|
|
|
{0x6B, NULL, "WriteProcessMemory"},
|
|
|
|
|
{0x6C, NULL, "SetHardwareBreakPoint"},
|
|
|
|
|
{0x6D, NULL, "GetDebugThreadParam"},
|
|
|
|
|
{0x6E, NULL, "Unknown"},
|
|
|
|
|
{0x6F, NULL, "Unknown"},
|
|
|
|
|
{0x70, NULL, "ControlProcessMemory"},
|
|
|
|
|
{0x71, NULL, "MapProcessMemory"},
|
|
|
|
|
{0x72, NULL, "UnmapProcessMemory"},
|
|
|
|
|
{0x73, NULL, "Unknown"},
|
|
|
|
|
{0x74, NULL, "Unknown"},
|
|
|
|
|
{0x75, NULL, "Unknown"},
|
|
|
|
|
{0x76, NULL, "TerminateProcess"},
|
|
|
|
|
{0x77, NULL, "Unknown"},
|
|
|
|
|
{0x78, NULL, "CreateResourceLimit"},
|
|
|
|
|
{0x79, NULL, "Unknown"},
|
|
|
|
|
{0x7A, NULL, "Unknown"},
|
|
|
|
|
{0x7B, NULL, "Unknown"},
|
|
|
|
|
{0x7C, NULL, "KernelSetState"},
|
|
|
|
|
{0x7D, NULL, "QueryProcessMemory"},
|
|
|
|
|
{0x3E, nullptr, "ControlPerformanceCounter"},
|
|
|
|
|
{0x3F, nullptr, "Unknown"},
|
|
|
|
|
{0x40, nullptr, "Unknown"},
|
|
|
|
|
{0x41, nullptr, "Unknown"},
|
|
|
|
|
{0x42, nullptr, "Unknown"},
|
|
|
|
|
{0x43, nullptr, "Unknown"},
|
|
|
|
|
{0x44, nullptr, "Unknown"},
|
|
|
|
|
{0x45, nullptr, "Unknown"},
|
|
|
|
|
{0x46, nullptr, "Unknown"},
|
|
|
|
|
{0x47, nullptr, "CreatePort"},
|
|
|
|
|
{0x48, nullptr, "CreateSessionToPort"},
|
|
|
|
|
{0x49, nullptr, "CreateSession"},
|
|
|
|
|
{0x4A, nullptr, "AcceptSession"},
|
|
|
|
|
{0x4B, nullptr, "ReplyAndReceive1"},
|
|
|
|
|
{0x4C, nullptr, "ReplyAndReceive2"},
|
|
|
|
|
{0x4D, nullptr, "ReplyAndReceive3"},
|
|
|
|
|
{0x4E, nullptr, "ReplyAndReceive4"},
|
|
|
|
|
{0x4F, nullptr, "ReplyAndReceive"},
|
|
|
|
|
{0x50, nullptr, "BindInterrupt"},
|
|
|
|
|
{0x51, nullptr, "UnbindInterrupt"},
|
|
|
|
|
{0x52, nullptr, "InvalidateProcessDataCache"},
|
|
|
|
|
{0x53, nullptr, "StoreProcessDataCache"},
|
|
|
|
|
{0x54, nullptr, "FlushProcessDataCache"},
|
|
|
|
|
{0x55, nullptr, "StartInterProcessDma"},
|
|
|
|
|
{0x56, nullptr, "StopDma"},
|
|
|
|
|
{0x57, nullptr, "GetDmaState"},
|
|
|
|
|
{0x58, nullptr, "RestartDma"},
|
|
|
|
|
{0x59, nullptr, "Unknown"},
|
|
|
|
|
{0x5A, nullptr, "Unknown"},
|
|
|
|
|
{0x5B, nullptr, "Unknown"},
|
|
|
|
|
{0x5C, nullptr, "Unknown"},
|
|
|
|
|
{0x5D, nullptr, "Unknown"},
|
|
|
|
|
{0x5E, nullptr, "Unknown"},
|
|
|
|
|
{0x5F, nullptr, "Unknown"},
|
|
|
|
|
{0x60, nullptr, "DebugActiveProcess"},
|
|
|
|
|
{0x61, nullptr, "BreakDebugProcess"},
|
|
|
|
|
{0x62, nullptr, "TerminateDebugProcess"},
|
|
|
|
|
{0x63, nullptr, "GetProcessDebugEvent"},
|
|
|
|
|
{0x64, nullptr, "ContinueDebugEvent"},
|
|
|
|
|
{0x65, nullptr, "GetProcessList"},
|
|
|
|
|
{0x66, nullptr, "GetThreadList"},
|
|
|
|
|
{0x67, nullptr, "GetDebugThreadContext"},
|
|
|
|
|
{0x68, nullptr, "SetDebugThreadContext"},
|
|
|
|
|
{0x69, nullptr, "QueryDebugProcessMemory"},
|
|
|
|
|
{0x6A, nullptr, "ReadProcessMemory"},
|
|
|
|
|
{0x6B, nullptr, "WriteProcessMemory"},
|
|
|
|
|
{0x6C, nullptr, "SetHardwareBreakPoint"},
|
|
|
|
|
{0x6D, nullptr, "GetDebugThreadParam"},
|
|
|
|
|
{0x6E, nullptr, "Unknown"},
|
|
|
|
|
{0x6F, nullptr, "Unknown"},
|
|
|
|
|
{0x70, nullptr, "ControlProcessMemory"},
|
|
|
|
|
{0x71, nullptr, "MapProcessMemory"},
|
|
|
|
|
{0x72, nullptr, "UnmapProcessMemory"},
|
|
|
|
|
{0x73, nullptr, "Unknown"},
|
|
|
|
|
{0x74, nullptr, "Unknown"},
|
|
|
|
|
{0x75, nullptr, "Unknown"},
|
|
|
|
|
{0x76, nullptr, "TerminateProcess"},
|
|
|
|
|
{0x77, nullptr, "Unknown"},
|
|
|
|
|
{0x78, nullptr, "CreateResourceLimit"},
|
|
|
|
|
{0x79, nullptr, "Unknown"},
|
|
|
|
|
{0x7A, nullptr, "Unknown"},
|
|
|
|
|
{0x7B, nullptr, "Unknown"},
|
|
|
|
|
{0x7C, nullptr, "KernelSetState"},
|
|
|
|
|
{0x7D, nullptr, "QueryProcessMemory"},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void Register() {
|
|
|
|
|