From fda023c9fa64bf1b512ef81a50f8661d3c462b81 Mon Sep 17 00:00:00 2001 From: wwylele Date: Sun, 3 Dec 2017 12:08:57 +0200 Subject: [PATCH] ipc_helper: split PushMoveObjects and PushCopyObjects --- src/core/hle/ipc_helpers.h | 12 ++++++++++-- src/core/hle/service/fs/archive.cpp | 2 +- src/core/hle/service/sm/srv.cpp | 6 +++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index d7127e8992..08843989b0 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -114,7 +114,10 @@ public: void PushMoveHandles(H... handles); template - void PushObjects(Kernel::SharedPtr... pointers); + void PushCopyObjects(Kernel::SharedPtr... pointers); + + template + void PushMoveObjects(Kernel::SharedPtr... pointers); void PushCurrentPIDHandle(); @@ -187,7 +190,12 @@ inline void RequestBuilder::PushMoveHandles(H... handles) { } template -inline void RequestBuilder::PushObjects(Kernel::SharedPtr... pointers) { +inline void RequestBuilder::PushCopyObjects(Kernel::SharedPtr... pointers) { + PushCopyHandles(context->AddOutgoingHandle(std::move(pointers))...); +} + +template +inline void RequestBuilder::PushMoveObjects(Kernel::SharedPtr... pointers) { PushMoveHandles(context->AddOutgoingHandle(std::move(pointers))...); } diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 855a63a5c8..c53b62f4ca 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -206,7 +206,7 @@ void File::OpenLinkFile(Kernel::HLERequestContext& ctx) { ClientConnected(std::get>(sessions)); rb.Push(RESULT_SUCCESS); - rb.PushObjects(std::get>(sessions)); + rb.PushMoveObjects(std::get>(sessions)); } File::~File() {} diff --git a/src/core/hle/service/sm/srv.cpp b/src/core/hle/service/sm/srv.cpp index d05cec5b3e..b669aa8a9c 100644 --- a/src/core/hle/service/sm/srv.cpp +++ b/src/core/hle/service/sm/srv.cpp @@ -66,7 +66,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); - rb.PushObjects(notification_semaphore); + rb.PushCopyObjects(notification_semaphore); LOG_WARNING(Service_SRV, "(STUBBED) called"); } @@ -114,7 +114,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) { (*session)->GetObjectId()); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(session.Code()); - rb.PushObjects(std::move(session).Unwrap()); + rb.PushMoveObjects(std::move(session).Unwrap()); } else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) { LOG_WARNING(Service_SRV, "called service=%s -> ERR_MAX_CONNECTIONS_REACHED", name.c_str()); // TODO(Subv): Put the caller guest thread to sleep until this port becomes available again. @@ -204,7 +204,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); - rb.PushObjects(port.Unwrap()); + rb.PushMoveObjects(port.Unwrap()); } SRV::SRV(std::shared_ptr service_manager)