From c42e93aacab72d4845a449ad583be0a1010b0bd6 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 9 Jun 2014 22:30:39 -0400 Subject: [PATCH] SVC: Renamed all function wrapper templates to Wrap, moved to HLE namespace. --- src/core/hle/function_wrappers.h | 50 +++--- src/core/hle/svc.cpp | 252 +++++++++++++++---------------- 2 files changed, 145 insertions(+), 157 deletions(-) diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index e8afa90d6..aa5278c8a 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h @@ -8,29 +8,27 @@ #include "core/mem_map.h" #include "core/hle/hle.h" -namespace Wrap { +namespace HLE { //////////////////////////////////////////////////////////////////////////////////////////////////// // Function wrappers that return type s32 -namespace S32 { - -template void U32_U32_U32_U32() { +template void Wrap() { RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3))); } -template void U32_U32_U32_U32_U32() { +template void Wrap() { RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4))); } -template void U32P_U32_U32_U32_U32_U32(){ +template void Wrap(){ u32 param_1 = 0; u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)); Core::g_app_core->SetReg(1, param_1); RETURN(retval); } -template void S32P_U32P_S32_Bool_S64() { +template void Wrap() { s32 param_1 = 0; s32 retval = func(¶m_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2), (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0))); @@ -39,82 +37,72 @@ template void S32P_U32P_S32_Bool_S64() { } // TODO(bunnei): Is this correct? Probably not -template void U32_U32_U32_U32_S64() { +template void Wrap() { RETURN(func(PARAM(5), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(4) << 32) | PARAM(0)))); } -template void U32_S64() { +template void Wrap() { RETURN(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2)))); } -template void VoidP_VoidP_U32(){ +template void Wrap(){ RETURN(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2))); } -template void S32P_U32(){ +template void Wrap(){ s32 param_1 = 0; u32 retval = func(¶m_1, PARAM(1)); Core::g_app_core->SetReg(1, param_1); RETURN(retval); } -template void U32_S32() { +template void Wrap() { RETURN(func(PARAM(0), (s32)PARAM(1))); } -template void U32P_U32(){ +template void Wrap(){ u32 param_1 = 0; u32 retval = func(¶m_1, PARAM(1)); Core::g_app_core->SetReg(1, param_1); RETURN(retval); } -template void U32() { +template void Wrap() { RETURN(func(PARAM(0))); } -template void U32P() { +template void Wrap() { RETURN(func(Memory::GetPointer(PARAM(0)))); } -template void S64P_U32_VoidP_S32(){ +template void Wrap(){ RETURN(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), (s32)PARAM(3))); } -template void U32P_CharP() { +template void Wrap() { u32 param_1 = 0; u32 retval = func(¶m_1, Memory::GetCharPointer(PARAM(1))); Core::g_app_core->SetReg(1, param_1); RETURN(retval); } -} // namespace S32 - //////////////////////////////////////////////////////////////////////////////////////////////////// // Function wrappers that return type u32 -namespace U32 { - -template void Void() { +template void Wrap() { RETURN(func()); } -} // namespace U32 - //////////////////////////////////////////////////////////////////////////////////////////////////// /// Function wrappers that return type void -namespace Void { - -template void S64() { +template void Wrap() { func(((s64)PARAM(1) << 32) | PARAM(0)); } -template void CharP() { +template void Wrap() { func(Memory::GetCharPointer(PARAM(0))); } -} // namespace Void - -} // namespace Wrap +} // namespace HLE diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index d964d062e..441d8ce8d 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -332,132 +332,132 @@ void SleepThread(s64 nanoseconds) { } const HLE::FunctionDef SVC_Table[] = { - {0x00, nullptr, "Unknown"}, - {0x01, Wrap::S32::U32P_U32_U32_U32_U32_U32, "ControlMemory"}, - {0x02, Wrap::S32::VoidP_VoidP_U32, "QueryMemory"}, - {0x03, nullptr, "ExitProcess"}, - {0x04, nullptr, "GetProcessAffinityMask"}, - {0x05, nullptr, "SetProcessAffinityMask"}, - {0x06, nullptr, "GetProcessIdealProcessor"}, - {0x07, nullptr, "SetProcessIdealProcessor"}, - {0x08, Wrap::S32::U32_U32_U32_U32_U32, "CreateThread"}, - {0x09, Wrap::U32::Void, "ExitThread"}, - {0x0A, Wrap::Void::S64, "SleepThread"}, - {0x0B, Wrap::S32::S32P_U32, "GetThreadPriority"}, - {0x0C, Wrap::S32::U32_S32, "SetThreadPriority"}, - {0x0D, nullptr, "GetThreadAffinityMask"}, - {0x0E, nullptr, "SetThreadAffinityMask"}, - {0x0F, nullptr, "GetThreadIdealProcessor"}, - {0x10, nullptr, "SetThreadIdealProcessor"}, - {0x11, nullptr, "GetCurrentProcessorNumber"}, - {0x12, nullptr, "Run"}, - {0x13, Wrap::S32::U32P_U32, "CreateMutex"}, - {0x14, Wrap::S32::U32, "ReleaseMutex"}, - {0x15, nullptr, "CreateSemaphore"}, - {0x16, nullptr, "ReleaseSemaphore"}, - {0x17, Wrap::S32::U32P_U32, "CreateEvent"}, - {0x18, Wrap::S32::U32, "SignalEvent"}, - {0x19, Wrap::S32::U32, "ClearEvent"}, - {0x1A, nullptr, "CreateTimer"}, - {0x1B, nullptr, "SetTimer"}, - {0x1C, nullptr, "CancelTimer"}, - {0x1D, nullptr, "ClearTimer"}, - {0x1E, nullptr, "CreateMemoryBlock"}, - {0x1F, Wrap::S32::U32_U32_U32_U32, "MapMemoryBlock"}, - {0x20, nullptr, "UnmapMemoryBlock"}, - {0x21, Wrap::S32::U32P, "CreateAddressArbiter"}, - {0x22, Wrap::S32::U32_U32_U32_U32_S64, "ArbitrateAddress"}, - {0x23, Wrap::S32::U32, "CloseHandle"}, - {0x24, Wrap::S32::U32_S64, "WaitSynchronization1"}, - {0x25, Wrap::S32::S32P_U32P_S32_Bool_S64, "WaitSynchronizationN"}, - {0x26, nullptr, "SignalAndWait"}, - {0x27, Wrap::S32::U32P_U32, "DuplicateHandle"}, - {0x28, nullptr, "GetSystemTick"}, - {0x29, nullptr, "GetHandleInfo"}, - {0x2A, nullptr, "GetSystemInfo"}, - {0x2B, nullptr, "GetProcessInfo"}, - {0x2C, nullptr, "GetThreadInfo"}, - {0x2D, Wrap::S32::U32P_CharP, "ConnectToPort"}, - {0x2E, nullptr, "SendSyncRequest1"}, - {0x2F, nullptr, "SendSyncRequest2"}, - {0x30, nullptr, "SendSyncRequest3"}, - {0x31, nullptr, "SendSyncRequest4"}, - {0x32, Wrap::S32::U32, "SendSyncRequest"}, - {0x33, nullptr, "OpenProcess"}, - {0x34, nullptr, "OpenThread"}, - {0x35, nullptr, "GetProcessId"}, - {0x36, nullptr, "GetProcessIdOfThread"}, - {0x37, Wrap::S32::U32P_U32, "GetThreadId"}, - {0x38, Wrap::S32::U32P_U32, "GetResourceLimit"}, - {0x39, nullptr, "GetResourceLimitLimitValues"}, - {0x3A, Wrap::S32::S64P_U32_VoidP_S32, "GetResourceLimitCurrentValues"}, - {0x3B, nullptr, "GetThreadContext"}, - {0x3C, nullptr, "Break"}, - {0x3D, Wrap::Void::CharP, "OutputDebugString"}, - {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"}, + {0x00, nullptr, "Unknown"}, + {0x01, HLE::Wrap, "ControlMemory"}, + {0x02, HLE::Wrap, "QueryMemory"}, + {0x03, nullptr, "ExitProcess"}, + {0x04, nullptr, "GetProcessAffinityMask"}, + {0x05, nullptr, "SetProcessAffinityMask"}, + {0x06, nullptr, "GetProcessIdealProcessor"}, + {0x07, nullptr, "SetProcessIdealProcessor"}, + {0x08, HLE::Wrap, "CreateThread"}, + {0x09, HLE::Wrap, "ExitThread"}, + {0x0A, HLE::Wrap, "SleepThread"}, + {0x0B, HLE::Wrap, "GetThreadPriority"}, + {0x0C, HLE::Wrap, "SetThreadPriority"}, + {0x0D, nullptr, "GetThreadAffinityMask"}, + {0x0E, nullptr, "SetThreadAffinityMask"}, + {0x0F, nullptr, "GetThreadIdealProcessor"}, + {0x10, nullptr, "SetThreadIdealProcessor"}, + {0x11, nullptr, "GetCurrentProcessorNumber"}, + {0x12, nullptr, "Run"}, + {0x13, HLE::Wrap, "CreateMutex"}, + {0x14, HLE::Wrap, "ReleaseMutex"}, + {0x15, nullptr, "CreateSemaphore"}, + {0x16, nullptr, "ReleaseSemaphore"}, + {0x17, HLE::Wrap, "CreateEvent"}, + {0x18, HLE::Wrap, "SignalEvent"}, + {0x19, HLE::Wrap, "ClearEvent"}, + {0x1A, nullptr, "CreateTimer"}, + {0x1B, nullptr, "SetTimer"}, + {0x1C, nullptr, "CancelTimer"}, + {0x1D, nullptr, "ClearTimer"}, + {0x1E, nullptr, "CreateMemoryBlock"}, + {0x1F, HLE::Wrap, "MapMemoryBlock"}, + {0x20, nullptr, "UnmapMemoryBlock"}, + {0x21, HLE::Wrap, "CreateAddressArbiter"}, + {0x22, HLE::Wrap, "ArbitrateAddress"}, + {0x23, HLE::Wrap, "CloseHandle"}, + {0x24, HLE::Wrap, "WaitSynchronization1"}, + {0x25, HLE::Wrap, "WaitSynchronizationN"}, + {0x26, nullptr, "SignalAndWait"}, + {0x27, HLE::Wrap, "DuplicateHandle"}, + {0x28, nullptr, "GetSystemTick"}, + {0x29, nullptr, "GetHandleInfo"}, + {0x2A, nullptr, "GetSystemInfo"}, + {0x2B, nullptr, "GetProcessInfo"}, + {0x2C, nullptr, "GetThreadInfo"}, + {0x2D, HLE::Wrap, "ConnectToPort"}, + {0x2E, nullptr, "SendSyncRequest1"}, + {0x2F, nullptr, "SendSyncRequest2"}, + {0x30, nullptr, "SendSyncRequest3"}, + {0x31, nullptr, "SendSyncRequest4"}, + {0x32, HLE::Wrap, "SendSyncRequest"}, + {0x33, nullptr, "OpenProcess"}, + {0x34, nullptr, "OpenThread"}, + {0x35, nullptr, "GetProcessId"}, + {0x36, nullptr, "GetProcessIdOfThread"}, + {0x37, HLE::Wrap, "GetThreadId"}, + {0x38, HLE::Wrap, "GetResourceLimit"}, + {0x39, nullptr, "GetResourceLimitLimitValues"}, + {0x3A, HLE::Wrap, "GetResourceLimitCurrentValues"}, + {0x3B, nullptr, "GetThreadContext"}, + {0x3C, nullptr, "Break"}, + {0x3D, HLE::Wrap, "OutputDebugString"}, + {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() {