summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2017-10-31 19:30:05 -0400
committerGravatar bunnei2017-10-31 19:30:05 -0400
commit3597650f221036deb382d4e8812e717014619eee (patch)
treee16f1231d1423a16edf40735b9462187d0792138 /src
parenthle: Use Switch formatted result codes. (diff)
downloadyuzu-3597650f221036deb382d4e8812e717014619eee.tar.gz
yuzu-3597650f221036deb382d4e8812e717014619eee.tar.xz
yuzu-3597650f221036deb382d4e8812e717014619eee.zip
service: Return proper result code for IPC::CommandType::Close.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/hle_ipc.h2
-rw-r--r--src/core/hle/kernel/server_session.cpp11
-rw-r--r--src/core/hle/service/service.cpp6
-rw-r--r--src/core/hle/service/service.h2
4 files changed, 12 insertions, 9 deletions
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index b58e57b14..bf8cfc2a3 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -40,7 +40,7 @@ public:
40 * this request (ServerSession, Originator thread, Translated command buffer, etc). 40 * this request (ServerSession, Originator thread, Translated command buffer, etc).
41 * @returns ResultCode the result code of the translate operation. 41 * @returns ResultCode the result code of the translate operation.
42 */ 42 */
43 virtual void HandleSyncRequest(SharedPtr<ServerSession> server_session) = 0; 43 virtual ResultCode HandleSyncRequest(SharedPtr<ServerSession> server_session) = 0;
44 44
45 /** 45 /**
46 * Signals that a client has just connected to this HLE handler and keeps the 46 * Signals that a client has just connected to this HLE handler and keeps the
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp
index 337896abf..68e5cc2b7 100644
--- a/src/core/hle/kernel/server_session.cpp
+++ b/src/core/hle/kernel/server_session.cpp
@@ -60,12 +60,13 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
60 // similar. 60 // similar.
61 61
62 // If this ServerSession has an associated HLE handler, forward the request to it. 62 // If this ServerSession has an associated HLE handler, forward the request to it.
63 ResultCode result{RESULT_SUCCESS};
63 if (hle_handler != nullptr) { 64 if (hle_handler != nullptr) {
64 // Attempt to translate the incoming request's command buffer. 65 // Attempt to translate the incoming request's command buffer.
65 ResultCode result = TranslateHLERequest(this); 66 ResultCode translate_result = TranslateHLERequest(this);
66 if (result.IsError()) 67 if (translate_result.IsError())
67 return result; 68 return translate_result;
68 hle_handler->HandleSyncRequest(SharedPtr<ServerSession>(this)); 69 result = hle_handler->HandleSyncRequest(SharedPtr<ServerSession>(this));
69 // TODO(Subv): Translate the response command buffer. 70 // TODO(Subv): Translate the response command buffer.
70 } else { 71 } else {
71 // Add the thread to the list of threads that have issued a sync request with this 72 // Add the thread to the list of threads that have issued a sync request with this
@@ -76,7 +77,7 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
76 // If this ServerSession does not have an HLE implementation, just wake up the threads waiting 77 // If this ServerSession does not have an HLE implementation, just wake up the threads waiting
77 // on it. 78 // on it.
78 WakeupAllWaitingThreads(); 79 WakeupAllWaitingThreads();
79 return RESULT_SUCCESS; 80 return result;
80} 81}
81 82
82ServerSession::SessionPair ServerSession::CreateSessionPair(const std::string& name, 83ServerSession::SessionPair ServerSession::CreateSessionPair(const std::string& name,
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 826a775d1..b5d798e26 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -124,7 +124,7 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
124 handler_invoker(this, info->handler_callback, ctx); 124 handler_invoker(this, info->handler_callback, ctx);
125} 125}
126 126
127void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_session) { 127ResultCode ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_session) {
128 u32* cmd_buf = (u32*)Memory::GetPointer(Kernel::GetCurrentThread()->GetTLSAddress()); 128 u32* cmd_buf = (u32*)Memory::GetPointer(Kernel::GetCurrentThread()->GetTLSAddress());
129 129
130 // TODO(yuriks): The kernel should be the one handling this as part of translation after 130 // TODO(yuriks): The kernel should be the one handling this as part of translation after
@@ -137,7 +137,7 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
137 case IPC::CommandType::Close: { 137 case IPC::CommandType::Close: {
138 IPC::RequestBuilder rb{context, 1}; 138 IPC::RequestBuilder rb{context, 1};
139 rb.Push(RESULT_SUCCESS); 139 rb.Push(RESULT_SUCCESS);
140 break; 140 return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead);
141 } 141 }
142 case IPC::CommandType::Control: { 142 case IPC::CommandType::Control: {
143 SM::g_service_manager->InvokeControlRequest(context); 143 SM::g_service_manager->InvokeControlRequest(context);
@@ -153,6 +153,8 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
153 153
154 context.WriteToOutgoingCommandBuffer(cmd_buf, *Kernel::g_current_process, 154 context.WriteToOutgoingCommandBuffer(cmd_buf, *Kernel::g_current_process,
155 Kernel::g_handle_table); 155 Kernel::g_handle_table);
156
157 return RESULT_SUCCESS;
156} 158}
157 159
158//////////////////////////////////////////////////////////////////////////////////////////////////// 160////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index ff76dd2de..ad5f95292 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -63,7 +63,7 @@ public:
63 63
64 void InvokeRequest(Kernel::HLERequestContext& ctx); 64 void InvokeRequest(Kernel::HLERequestContext& ctx);
65 65
66 void HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) override; 66 ResultCode HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) override;
67 67
68protected: 68protected:
69 /// Member-function pointer type of SyncRequest handlers. 69 /// Member-function pointer type of SyncRequest handlers.