diff options
| author | 2016-12-14 20:35:33 -0800 | |
|---|---|---|
| committer | 2016-12-14 20:35:33 -0800 | |
| commit | 905fc92ce1f7d99d8819a17b180a559b3a9f15de (patch) | |
| tree | cc992764c2ea065d8d30dce2055cc1efe167bc59 /src/core/hle/svc.cpp | |
| parent | Merge pull request #2166 from endrift/clang-detect (diff) | |
| parent | Fixed the codestyle to match our clang-format rules. (diff) | |
| download | yuzu-905fc92ce1f7d99d8819a17b180a559b3a9f15de.tar.gz yuzu-905fc92ce1f7d99d8819a17b180a559b3a9f15de.tar.xz yuzu-905fc92ce1f7d99d8819a17b180a559b3a9f15de.zip | |
Merge pull request #2249 from Subv/sessions_v3
Kernel/IPC: Use Ports and Sessions as the fundamental building block of Inter Process Communication.
Diffstat (limited to 'src/core/hle/svc.cpp')
| -rw-r--r-- | src/core/hle/svc.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index c6b80dc50..e5ba9a484 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "core/hle/function_wrappers.h" | 13 | #include "core/hle/function_wrappers.h" |
| 14 | #include "core/hle/kernel/address_arbiter.h" | 14 | #include "core/hle/kernel/address_arbiter.h" |
| 15 | #include "core/hle/kernel/client_port.h" | 15 | #include "core/hle/kernel/client_port.h" |
| 16 | #include "core/hle/kernel/client_session.h" | ||
| 16 | #include "core/hle/kernel/event.h" | 17 | #include "core/hle/kernel/event.h" |
| 17 | #include "core/hle/kernel/memory.h" | 18 | #include "core/hle/kernel/memory.h" |
| 18 | #include "core/hle/kernel/mutex.h" | 19 | #include "core/hle/kernel/mutex.h" |
| @@ -20,6 +21,7 @@ | |||
| 20 | #include "core/hle/kernel/resource_limit.h" | 21 | #include "core/hle/kernel/resource_limit.h" |
| 21 | #include "core/hle/kernel/semaphore.h" | 22 | #include "core/hle/kernel/semaphore.h" |
| 22 | #include "core/hle/kernel/server_port.h" | 23 | #include "core/hle/kernel/server_port.h" |
| 24 | #include "core/hle/kernel/server_session.h" | ||
| 23 | #include "core/hle/kernel/shared_memory.h" | 25 | #include "core/hle/kernel/shared_memory.h" |
| 24 | #include "core/hle/kernel/thread.h" | 26 | #include "core/hle/kernel/thread.h" |
| 25 | #include "core/hle/kernel/timer.h" | 27 | #include "core/hle/kernel/timer.h" |
| @@ -222,20 +224,29 @@ static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) { | |||
| 222 | return ERR_NOT_FOUND; | 224 | return ERR_NOT_FOUND; |
| 223 | } | 225 | } |
| 224 | 226 | ||
| 225 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(it->second)); | 227 | auto client_port = it->second; |
| 228 | |||
| 229 | SharedPtr<Kernel::ClientSession> client_session; | ||
| 230 | CASCADE_RESULT(client_session, client_port->Connect()); | ||
| 231 | |||
| 232 | // Return the client session | ||
| 233 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(client_session)); | ||
| 226 | return RESULT_SUCCESS; | 234 | return RESULT_SUCCESS; |
| 227 | } | 235 | } |
| 228 | 236 | ||
| 229 | /// Synchronize to an OS service | 237 | /// Makes a blocking IPC call to an OS service. |
| 230 | static ResultCode SendSyncRequest(Handle handle) { | 238 | static ResultCode SendSyncRequest(Handle handle) { |
| 231 | SharedPtr<Kernel::Session> session = Kernel::g_handle_table.Get<Kernel::Session>(handle); | 239 | SharedPtr<Kernel::ClientSession> session = |
| 240 | Kernel::g_handle_table.Get<Kernel::ClientSession>(handle); | ||
| 232 | if (session == nullptr) { | 241 | if (session == nullptr) { |
| 233 | return ERR_INVALID_HANDLE; | 242 | return ERR_INVALID_HANDLE; |
| 234 | } | 243 | } |
| 235 | 244 | ||
| 236 | LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str()); | 245 | LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str()); |
| 237 | 246 | ||
| 238 | return session->SyncRequest().Code(); | 247 | // TODO(Subv): svcSendSyncRequest should put the caller thread to sleep while the server |
| 248 | // responds and cause a reschedule. | ||
| 249 | return session->SendSyncRequest(); | ||
| 239 | } | 250 | } |
| 240 | 251 | ||
| 241 | /// Close a handle | 252 | /// Close a handle |