diff options
| author | Subv <subv2112@gmail.com> | 2016-06-14 18:03:30 -0500 |
|---|---|---|
| committer | Subv <subv2112@gmail.com> | 2016-11-30 23:02:05 -0500 |
| commit | 073653e858abf377fd1ebbdb071809c8830ce99d (patch) | |
| tree | a29e1c1e50d53162ed89cd90e8c069525150392f /src/core/hle/service/service.cpp | |
| parent | 68c00ee771791e5975912c4e0d4be0fb5ab6b8fa (diff) | |
Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
All handles obtained via srv::GetServiceHandle or svcConnectToPort are references to ClientSessions.
Service modules will wait on the counterpart of those ClientSessions (Called ServerSessions) using svcReplyAndReceive or svcWaitSynchronization[1|N], and will be awoken when a SyncRequest is performed.
HLE Interfaces are now ClientPorts which override the HandleSyncRequest virtual member function to perform command handling immediately.
Diffstat (limited to 'src/core/hle/service/service.cpp')
| -rw-r--r-- | src/core/hle/service/service.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index ca7eeac8a..f51a042ff 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -41,8 +41,8 @@ namespace Service { -std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_kernel_named_ports; -std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_srv_services; +std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> g_kernel_named_ports; +std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> g_srv_services; /** * Creates a function string for logging, complete with the name (or header code, depending @@ -61,7 +61,7 @@ static std::string MakeFunctionString(const char* name, const char* port_name, return function_string; } -ResultVal<bool> Interface::SyncRequest() { +ResultCode Interface::HandleSyncRequest() { u32* cmd_buff = Kernel::GetCommandBuffer(); auto itr = m_functions.find(cmd_buff[0]); @@ -75,14 +75,14 @@ ResultVal<bool> Interface::SyncRequest() { // TODO(bunnei): Hack - ignore error cmd_buff[1] = 0; - return MakeResult<bool>(false); + return RESULT_SUCCESS; } LOG_TRACE(Service, "%s", MakeFunctionString(itr->second.name, GetPortName().c_str(), cmd_buff).c_str()); itr->second.func(this); - return MakeResult<bool>(false); // TODO: Implement return from actual function + return RESULT_SUCCESS; // TODO: Implement return from actual function, it should fail if the parameter translation fails } void Interface::Register(const FunctionInfo* functions, size_t n) { @@ -97,10 +97,16 @@ void Interface::Register(const FunctionInfo* functions, size_t n) { // Module interface static void AddNamedPort(Interface* interface_) { + interface_->name = interface_->GetPortName(); + interface_->active_sessions = 0; + interface_->max_sessions = interface_->GetMaxSessions(); g_kernel_named_ports.emplace(interface_->GetPortName(), interface_); } void AddService(Interface* interface_) { + interface_->name = interface_->GetPortName(); + interface_->active_sessions = 0; + interface_->max_sessions = interface_->GetMaxSessions(); g_srv_services.emplace(interface_->GetPortName(), interface_); } |
