mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-30 13:24:16 +01:00
Kernel: Implement CreateSession SVC
This commit is contained in:
parent
72b69cea4b
commit
f94093d0fd
@ -232,6 +232,16 @@ void Wrap() {
|
|||||||
FuncReturn(retval);
|
FuncReturn(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <ResultCode func(Kernel::Handle*, Kernel::Handle*)>
|
||||||
|
void Wrap() {
|
||||||
|
Kernel::Handle param_1 = 0;
|
||||||
|
Kernel::Handle param_2 = 0;
|
||||||
|
u32 retval = func(¶m_1, ¶m_2).raw;
|
||||||
|
Core::CPU().SetReg(1, param_1);
|
||||||
|
Core::CPU().SetReg(2, param_2);
|
||||||
|
FuncReturn(retval);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Function wrappers that return type u32
|
// Function wrappers that return type u32
|
||||||
|
|
||||||
|
@ -36,8 +36,9 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Namespace SVC
|
// Namespace SVC
|
||||||
|
|
||||||
using Kernel::SharedPtr;
|
|
||||||
using Kernel::ERR_INVALID_HANDLE;
|
using Kernel::ERR_INVALID_HANDLE;
|
||||||
|
using Kernel::Handle;
|
||||||
|
using Kernel::SharedPtr;
|
||||||
|
|
||||||
namespace SVC {
|
namespace SVC {
|
||||||
|
|
||||||
@ -933,7 +934,6 @@ static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client
|
|||||||
|
|
||||||
using Kernel::ServerPort;
|
using Kernel::ServerPort;
|
||||||
using Kernel::ClientPort;
|
using Kernel::ClientPort;
|
||||||
using Kernel::SharedPtr;
|
|
||||||
|
|
||||||
auto ports = ServerPort::CreatePortPair(max_sessions);
|
auto ports = ServerPort::CreatePortPair(max_sessions);
|
||||||
CASCADE_RESULT(*client_port, Kernel::g_handle_table.Create(
|
CASCADE_RESULT(*client_port, Kernel::g_handle_table.Create(
|
||||||
@ -947,6 +947,19 @@ static ResultCode CreatePort(Kernel::Handle* server_port, Kernel::Handle* client
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ResultCode CreateSession(Handle* server_session, Handle* client_session) {
|
||||||
|
auto sessions = Kernel::ServerSession::CreateSessionPair();
|
||||||
|
|
||||||
|
auto& server = std::get<SharedPtr<Kernel::ServerSession>>(sessions);
|
||||||
|
CASCADE_RESULT(*server_session, Kernel::g_handle_table.Create(std::move(server)));
|
||||||
|
|
||||||
|
auto& client = std::get<SharedPtr<Kernel::ClientSession>>(sessions);
|
||||||
|
CASCADE_RESULT(*client_session, Kernel::g_handle_table.Create(std::move(client)));
|
||||||
|
|
||||||
|
LOG_TRACE(Kernel_SVC, "called");
|
||||||
|
return RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
|
static ResultCode GetSystemInfo(s64* out, u32 type, s32 param) {
|
||||||
using Kernel::MemoryRegion;
|
using Kernel::MemoryRegion;
|
||||||
|
|
||||||
@ -1122,7 +1135,7 @@ static const FunctionDef SVC_Table[] = {
|
|||||||
{0x46, nullptr, "Unknown"},
|
{0x46, nullptr, "Unknown"},
|
||||||
{0x47, HLE::Wrap<CreatePort>, "CreatePort"},
|
{0x47, HLE::Wrap<CreatePort>, "CreatePort"},
|
||||||
{0x48, nullptr, "CreateSessionToPort"},
|
{0x48, nullptr, "CreateSessionToPort"},
|
||||||
{0x49, nullptr, "CreateSession"},
|
{0x49, HLE::Wrap<CreateSession>, "CreateSession"},
|
||||||
{0x4A, nullptr, "AcceptSession"},
|
{0x4A, nullptr, "AcceptSession"},
|
||||||
{0x4B, nullptr, "ReplyAndReceive1"},
|
{0x4B, nullptr, "ReplyAndReceive1"},
|
||||||
{0x4C, nullptr, "ReplyAndReceive2"},
|
{0x4C, nullptr, "ReplyAndReceive2"},
|
||||||
|
Loading…
Reference in New Issue
Block a user