summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
authorGravatar Subv2016-11-30 22:50:13 -0500
committerGravatar Subv2016-11-30 23:12:35 -0500
commit009b15b3aa9858930f461d825f7dd030fc963801 (patch)
tree060b6a82ad6c093b1832cd9e96a4fdacf29448b5 /src/core/hle/svc.cpp
parentIPC/HLE: Associate the ClientSessions with their parent port's HLE interface ... (diff)
downloadyuzu-009b15b3aa9858930f461d825f7dd030fc963801.tar.gz
yuzu-009b15b3aa9858930f461d825f7dd030fc963801.tar.xz
yuzu-009b15b3aa9858930f461d825f7dd030fc963801.zip
A bit of a redesign.
Sessions and Ports are now detached from each other. HLE services are handled by means of a SessionRequestHandler class, Interface now inherits from this class. The File and Directory classes are no longer kernel objects, but SessionRequestHandlers instead, bound to a ServerSession when requested. File::OpenLinkFile now creates a new session pair and binds the File instance to it.
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index be03e53bc..6d990b5f2 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -21,6 +21,7 @@
21#include "core/hle/kernel/resource_limit.h" 21#include "core/hle/kernel/resource_limit.h"
22#include "core/hle/kernel/semaphore.h" 22#include "core/hle/kernel/semaphore.h"
23#include "core/hle/kernel/server_port.h" 23#include "core/hle/kernel/server_port.h"
24#include "core/hle/kernel/server_session.h"
24#include "core/hle/kernel/shared_memory.h" 25#include "core/hle/kernel/shared_memory.h"
25#include "core/hle/kernel/thread.h" 26#include "core/hle/kernel/thread.h"
26#include "core/hle/kernel/timer.h" 27#include "core/hle/kernel/timer.h"
@@ -223,13 +224,18 @@ static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) {
223 return ERR_NOT_FOUND; 224 return ERR_NOT_FOUND;
224 } 225 }
225 226
226 auto client_port = it->second; 227 auto client_port = std::get<Kernel::SharedPtr<Kernel::ClientPort>>(it->second);
228 // The hle_handler will be nullptr if this port was registered by the emulated
229 // application by means of svcCreatePort with a defined name.
230 auto hle_handler = std::get<std::shared_ptr<Service::Interface>>(it->second);
227 231
228 // Create a new session pair 232 // Create a new session pair
229 auto sessions = Kernel::ServerSession::CreateSessionPair(client_port, port_name); 233 auto sessions = Kernel::ServerSession::CreateSessionPair(port_name, hle_handler);
230 auto client_session = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); 234 auto client_session = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
231 auto server_session = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); 235 auto server_session = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
232 236
237 // TODO(Subv): Wait the current thread until the ServerPort calls AcceptSession.
238
233 // Add the server session to the port's queue 239 // Add the server session to the port's queue
234 client_port->AddWaitingSession(server_session); 240 client_port->AddWaitingSession(server_session);
235 241
@@ -247,6 +253,7 @@ static ResultCode SendSyncRequest(Handle handle) {
247 253
248 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str()); 254 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str());
249 255
256 // TODO(Subv): Wait the current thread and reschedule if this request is not going to be handled by HLE code.
250 return session->HandleSyncRequest(); 257 return session->HandleSyncRequest();
251} 258}
252 259