summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/function_wrappers.h10
-rw-r--r--src/core/hle/svc.cpp19
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
235template <ResultCode func(Kernel::Handle*, Kernel::Handle*)>
236void Wrap() {
237 Kernel::Handle param_1 = 0;
238 Kernel::Handle param_2 = 0;
239 u32 retval = func(&param_1, &param_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
39using Kernel::SharedPtr;
40using Kernel::ERR_INVALID_HANDLE; 39using Kernel::ERR_INVALID_HANDLE;
40using Kernel::Handle;
41using Kernel::SharedPtr;
41 42
42namespace SVC { 43namespace 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
950static 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
950static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) { 963static 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"},