summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-04 06:21:22 +0200
committerbunnei <bunneidev@gmail.com>2021-05-06 01:40:50 +0200
commit5e5933256b022f6890fc3f14164ae9e9c3ee9ae3 (patch)
treef65bdacde0afe5465446f90e26f2da1b8126cda9 /src/core/hle/kernel
parenthle: kernel: Migrate more of KThread to KAutoObject. (diff)
downloadyuzu-5e5933256b022f6890fc3f14164ae9e9c3ee9ae3.tar
yuzu-5e5933256b022f6890fc3f14164ae9e9c3ee9ae3.tar.gz
yuzu-5e5933256b022f6890fc3f14164ae9e9c3ee9ae3.tar.bz2
yuzu-5e5933256b022f6890fc3f14164ae9e9c3ee9ae3.tar.lz
yuzu-5e5933256b022f6890fc3f14164ae9e9c3ee9ae3.tar.xz
yuzu-5e5933256b022f6890fc3f14164ae9e9c3ee9ae3.tar.zst
yuzu-5e5933256b022f6890fc3f14164ae9e9c3ee9ae3.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/client_port.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp12
-rw-r--r--src/core/hle/kernel/hle_ipc.h19
-rw-r--r--src/core/hle/kernel/k_event.h4
-rw-r--r--src/core/hle/kernel/svc.cpp2
5 files changed, 22 insertions, 17 deletions
diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp
index 0b6957e31..431a90d82 100644
--- a/src/core/hle/kernel/client_port.cpp
+++ b/src/core/hle/kernel/client_port.cpp
@@ -28,7 +28,7 @@ ResultVal<std::shared_ptr<ClientSession>> ClientPort::Connect() {
auto [client, server] = Kernel::Session::Create(kernel, name);
if (server_port->HasHLEHandler()) {
- server_port->GetHLEHandler()->ClientConnected(std::move(server));
+ server_port->GetHLEHandler()->ClientConnected(client, std::move(server));
} else {
server_port->AppendPendingSession(std::move(server));
}
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 6ffe6ac41..a9702539f 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -35,15 +35,17 @@ SessionRequestHandler::SessionRequestHandler() = default;
SessionRequestHandler::~SessionRequestHandler() = default;
-void SessionRequestHandler::ClientConnected(std::shared_ptr<ServerSession> server_session) {
+void SessionRequestHandler::ClientConnected(std::shared_ptr<ClientSession> client_session,
+ std::shared_ptr<ServerSession> server_session) {
server_session->SetHleHandler(shared_from_this());
- connected_sessions.push_back(std::move(server_session));
+ client_sessions.push_back(std::move(client_session));
+ server_sessions.push_back(std::move(server_session));
}
void SessionRequestHandler::ClientDisconnected(
const std::shared_ptr<ServerSession>& server_session) {
server_session->SetHleHandler(nullptr);
- boost::range::remove_erase(connected_sessions, server_session);
+ boost::range::remove_erase(server_sessions, server_session);
}
HLERequestContext::HLERequestContext(KernelCore& kernel_, Core::Memory::Memory& memory_,
@@ -223,12 +225,12 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& thread) {
// for specific values in each of these descriptors.
for (auto& object : copy_objects) {
ASSERT(object != nullptr);
- dst_cmdbuf[current_offset++] = handle_table.Create(object).Unwrap();
+ dst_cmdbuf[current_offset++] = handle_table.Create(SharedFrom(object)).Unwrap();
}
for (auto& object : move_objects) {
ASSERT(object != nullptr);
- dst_cmdbuf[current_offset++] = handle_table.Create(object).Unwrap();
+ dst_cmdbuf[current_offset++] = handle_table.Create(SharedFrom(object)).Unwrap();
}
}
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 398f1c467..74a95bc76 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -39,6 +39,7 @@ class HandleTable;
class HLERequestContext;
class KernelCore;
class Process;
+class ClientSession;
class ServerSession;
class KThread;
class KReadableEvent;
@@ -71,7 +72,8 @@ public:
* associated ServerSession alive for the duration of the connection.
* @param server_session Owning pointer to the ServerSession associated with the connection.
*/
- void ClientConnected(std::shared_ptr<ServerSession> server_session);
+ void ClientConnected(
+ std::shared_ptr<ClientSession> client_session, std::shared_ptr<ServerSession> server_session);
/**
* Signals that a client has just disconnected from this HLE handler and releases the
@@ -84,7 +86,8 @@ protected:
/// List of sessions that are connected to this handler.
/// A ServerSession whose server endpoint is an HLE implementation is kept alive by this list
/// for the duration of the connection.
- std::vector<std::shared_ptr<ServerSession>> connected_sessions;
+ std::vector<std::shared_ptr<ClientSession>> client_sessions;
+ std::vector<std::shared_ptr<ServerSession>> server_sessions;
};
/**
@@ -218,21 +221,21 @@ public:
}
template <typename T>
- std::shared_ptr<T> GetCopyObject(std::size_t index) {
+ T* GetCopyObject(std::size_t index) {
return DynamicObjectCast<T>(copy_objects.at(index));
}
template <typename T>
- std::shared_ptr<T> GetMoveObject(std::size_t index) {
+ T* GetMoveObject(std::size_t index) {
return DynamicObjectCast<T>(move_objects.at(index));
}
- void AddMoveObject(std::shared_ptr<Object> object) {
- move_objects.emplace_back(std::move(object));
+ void AddMoveObject(Object* object) {
+ move_objects.emplace_back(object);
}
- void AddCopyObject(std::shared_ptr<Object> object) {
- copy_objects.emplace_back(std::move(object));
+ void AddCopyObject(Object* object) {
+ copy_objects.emplace_back(object);
}
void AddDomainObject(std::shared_ptr<SessionRequestHandler> object) {
diff --git a/src/core/hle/kernel/k_event.h b/src/core/hle/kernel/k_event.h
index 2fb887129..ec6894b16 100644
--- a/src/core/hle/kernel/k_event.h
+++ b/src/core/hle/kernel/k_event.h
@@ -32,8 +32,8 @@ public:
return HANDLE_TYPE;
}
- std::shared_ptr<KReadableEvent>& GetReadableEvent() {
- return readable_event;
+ KReadableEvent* GetReadableEvent() {
+ return readable_event.get();
}
std::shared_ptr<KWritableEvent>& GetWritableEvent() {
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 813450115..dca1bcc92 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1976,7 +1976,7 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o
auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*write_create_result); });
// Add the readable event to the handle table.
- const auto read_create_result = handle_table.Create(event->GetReadableEvent());
+ const auto read_create_result = handle_table.Create(SharedFrom(event->GetReadableEvent()));
if (read_create_result.Failed()) {
return read_create_result.Code();
}