diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/function_wrappers.h | 10 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 19 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 18b6e7017..b19b64509 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -232,6 +232,16 @@ void Wrap() { | |||
| 232 | FuncReturn(retval); | 232 | FuncReturn(retval); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | template <ResultCode func(Kernel::Handle*, Kernel::Handle*)> | ||
| 236 | void Wrap() { | ||
| 237 | Kernel::Handle param_1 = 0; | ||
| 238 | Kernel::Handle param_2 = 0; | ||
| 239 | u32 retval = func(¶m_1, ¶m_2).raw; | ||
| 240 | Core::CPU().SetReg(1, param_1); | ||
| 241 | Core::CPU().SetReg(2, param_2); | ||
| 242 | FuncReturn(retval); | ||
| 243 | } | ||
| 244 | |||
| 235 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 245 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 236 | // Function wrappers that return type u32 | 246 | // Function wrappers that return type u32 |
| 237 | 247 | ||
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index e68b9f16a..f459b1314 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -36,8 +36,9 @@ | |||
| 36 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 36 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 37 | // Namespace SVC | 37 | // Namespace SVC |
| 38 | 38 | ||
| 39 | using Kernel::SharedPtr; | ||
| 40 | using Kernel::ERR_INVALID_HANDLE; | 39 | using Kernel::ERR_INVALID_HANDLE; |
| 40 | using Kernel::Handle; | ||
| 41 | using Kernel::SharedPtr; | ||
| 41 | 42 | ||
| 42 | namespace SVC { | 43 | namespace SVC { |
| 43 | 44 | ||
| @@ -933,7 +934,6 @@ static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client | |||
| 933 | 934 | ||
| 934 | using Kernel::ServerPort; | 935 | using Kernel::ServerPort; |
| 935 | using Kernel::ClientPort; | 936 | using Kernel::ClientPort; |
| 936 | using Kernel::SharedPtr; | ||
| 937 | 937 | ||
| 938 | auto ports = ServerPort::CreatePortPair(max_sessions); | 938 | auto ports = ServerPort::CreatePortPair(max_sessions); |
| 939 | CASCADE_RESULT(*client_port, Kernel::g_handle_table.Create( | 939 | CASCADE_RESULT(*client_port, Kernel::g_handle_table.Create( |
| @@ -947,6 +947,19 @@ static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client | |||
| 947 | return RESULT_SUCCESS; | 947 | return RESULT_SUCCESS; |
| 948 | } | 948 | } |
| 949 | 949 | ||
| 950 | static ResultCode CreateSession(Handle* server_session, Handle* client_session) { | ||
| 951 | auto sessions = Kernel::ServerSession::CreateSessionPair(); | ||
| 952 | |||
| 953 | auto& server = std::get<SharedPtr<Kernel::ServerSession>>(sessions); | ||
| 954 | CASCADE_RESULT(*server_session, Kernel::g_handle_table.Create(std::move(server))); | ||
| 955 | |||
| 956 | auto& client = std::get<SharedPtr<Kernel::ClientSession>>(sessions); | ||
| 957 | CASCADE_RESULT(*client_session, Kernel::g_handle_table.Create(std::move(client))); | ||
| 958 | |||
| 959 | LOG_TRACE(Kernel_SVC, "called"); | ||
| 960 | return RESULT_SUCCESS; | ||
| 961 | } | ||
| 962 | |||
| 950 | static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) { | 963 | static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) { |
| 951 | using Kernel::MemoryRegion; | 964 | using Kernel::MemoryRegion; |
| 952 | 965 | ||
| @@ -1122,7 +1135,7 @@ static const FunctionDef SVC_Table[] = { | |||
| 1122 | {0x46, nullptr, "Unknown"}, | 1135 | {0x46, nullptr, "Unknown"}, |
| 1123 | {0x47, HLE::Wrap<CreatePort>, "CreatePort"}, | 1136 | {0x47, HLE::Wrap<CreatePort>, "CreatePort"}, |
| 1124 | {0x48, nullptr, "CreateSessionToPort"}, | 1137 | {0x48, nullptr, "CreateSessionToPort"}, |
| 1125 | {0x49, nullptr, "CreateSession"}, | 1138 | {0x49, HLE::Wrap<CreateSession>, "CreateSession"}, |
| 1126 | {0x4A, nullptr, "AcceptSession"}, | 1139 | {0x4A, nullptr, "AcceptSession"}, |
| 1127 | {0x4B, nullptr, "ReplyAndReceive1"}, | 1140 | {0x4B, nullptr, "ReplyAndReceive1"}, |
| 1128 | {0x4C, nullptr, "ReplyAndReceive2"}, | 1141 | {0x4C, nullptr, "ReplyAndReceive2"}, |