diff options
author | bunnei <bunneidev@gmail.com> | 2018-09-04 03:21:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-04 03:21:12 +0200 |
commit | 1c5636e690ca5844b396f97adc0a094558edc56f (patch) | |
tree | ed961ced2f21050de5af02bd5724aaa7de37d36e /src/core/hle/kernel/svc.cpp | |
parent | Merge pull request #1229 from lioncash/forward-decl (diff) | |
parent | service: Migrate global named port map to the KernelCore class (diff) | |
download | yuzu-1c5636e690ca5844b396f97adc0a094558edc56f.tar yuzu-1c5636e690ca5844b396f97adc0a094558edc56f.tar.gz yuzu-1c5636e690ca5844b396f97adc0a094558edc56f.tar.bz2 yuzu-1c5636e690ca5844b396f97adc0a094558edc56f.tar.lz yuzu-1c5636e690ca5844b396f97adc0a094558edc56f.tar.xz yuzu-1c5636e690ca5844b396f97adc0a094558edc56f.tar.zst yuzu-1c5636e690ca5844b396f97adc0a094558edc56f.zip |
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-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; } |