diff options
author | Lioncash <mathew1800@gmail.com> | 2018-09-02 17:58:58 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-09-02 18:35:30 +0200 |
commit | 1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2 (patch) | |
tree | f540b9cbc6db29bb5d41668f7efa8fc5c4e44469 /src/core/hle/kernel/svc.cpp | |
parent | Merge pull request #1213 from DarkLordZach/octopath-fs (diff) | |
download | yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar.gz yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar.bz2 yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar.lz yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar.xz yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar.zst yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 5da71cff0..1c9373ed8 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -68,19 +68,22 @@ static ResultCode UnmapMemory(VAddr dst_addr, VAddr src_addr, u64 size) { /// Connect to an OS service given the port name, returns the handle to the port to out static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address) { - if (!Memory::IsValidVirtualAddress(port_name_address)) + if (!Memory::IsValidVirtualAddress(port_name_address)) { return ERR_NOT_FOUND; + } static constexpr std::size_t PortNameMaxLength = 11; // Read 1 char beyond the max allowed port name to detect names that are too long. std::string port_name = Memory::ReadCString(port_name_address, PortNameMaxLength + 1); - if (port_name.size() > PortNameMaxLength) + if (port_name.size() > PortNameMaxLength) { return ERR_PORT_NAME_TOO_LONG; + } LOG_TRACE(Kernel_SVC, "called port_name={}", port_name); - auto it = Service::g_kernel_named_ports.find(port_name); - if (it == Service::g_kernel_named_ports.end()) { + auto& kernel = Core::System::GetInstance().Kernel(); + auto it = kernel.FindNamedPort(port_name); + if (!kernel.IsValidNamedPort(it)) { LOG_WARNING(Kernel_SVC, "tried to connect to unknown port: {}", port_name); return ERR_NOT_FOUND; } @@ -91,7 +94,6 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address CASCADE_RESULT(client_session, client_port->Connect()); // Return the client session - auto& kernel = Core::System::GetInstance().Kernel(); CASCADE_RESULT(*out_handle, kernel.HandleTable().Create(client_session)); return RESULT_SUCCESS; } |