summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-12-09 17:25:21 +0100
committerLiam <byteslice@airmail.cc>2023-12-09 19:45:25 +0100
commit5feda37688cafee8054910cd05916742c8263f89 (patch)
treed43fcaac349a7c636d2214cc1cb4e8ddaa69d8af /src/core
parentservice: use interface factory in server manager (diff)
downloadyuzu-5feda37688cafee8054910cd05916742c8263f89.tar
yuzu-5feda37688cafee8054910cd05916742c8263f89.tar.gz
yuzu-5feda37688cafee8054910cd05916742c8263f89.tar.bz2
yuzu-5feda37688cafee8054910cd05916742c8263f89.tar.lz
yuzu-5feda37688cafee8054910cd05916742c8263f89.tar.xz
yuzu-5feda37688cafee8054910cd05916742c8263f89.tar.zst
yuzu-5feda37688cafee8054910cd05916742c8263f89.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/k_server_session.cpp3
-rw-r--r--src/core/hle/service/hle_ipc.cpp15
-rw-r--r--src/core/hle/service/hle_ipc.h14
3 files changed, 19 insertions, 13 deletions
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp
index 3ea653163..598ec7878 100644
--- a/src/core/hle/kernel/k_server_session.cpp
+++ b/src/core/hle/kernel/k_server_session.cpp
@@ -462,8 +462,7 @@ Result KServerSession::ReceiveRequest(std::shared_ptr<Service::HLERequestContext
std::make_shared<Service::HLERequestContext>(m_kernel, memory, this, client_thread);
(*out_context)->SetSessionRequestManager(manager);
(*out_context)
- ->PopulateFromIncomingCommandBuffer(client_thread->GetOwnerProcess()->GetHandleTable(),
- cmd_buf);
+ ->PopulateFromIncomingCommandBuffer(*client_thread->GetOwnerProcess(), cmd_buf);
} else {
KThread* server_thread = GetCurrentThreadPointer(m_kernel);
KProcess& src_process = *client_thread->GetOwnerProcess();
diff --git a/src/core/hle/service/hle_ipc.cpp b/src/core/hle/service/hle_ipc.cpp
index ff374ae39..38955932c 100644
--- a/src/core/hle/service/hle_ipc.cpp
+++ b/src/core/hle/service/hle_ipc.cpp
@@ -146,8 +146,10 @@ HLERequestContext::HLERequestContext(Kernel::KernelCore& kernel_, Core::Memory::
HLERequestContext::~HLERequestContext() = default;
-void HLERequestContext::ParseCommandBuffer(const Kernel::KHandleTable& handle_table,
- u32_le* src_cmdbuf, bool incoming) {
+void HLERequestContext::ParseCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf,
+ bool incoming) {
+ client_handle_table = &process.GetHandleTable();
+
IPC::RequestParser rp(src_cmdbuf);
command_header = rp.PopRaw<IPC::CommandHeader>();
@@ -160,7 +162,8 @@ void HLERequestContext::ParseCommandBuffer(const Kernel::KHandleTable& handle_ta
if (command_header->enable_handle_descriptor) {
handle_descriptor_header = rp.PopRaw<IPC::HandleDescriptorHeader>();
if (handle_descriptor_header->send_current_pid) {
- pid = rp.Pop<u64>();
+ pid = process.GetProcessId();
+ rp.Skip(2, false);
}
if (incoming) {
// Populate the object lists with the data in the IPC request.
@@ -267,9 +270,9 @@ void HLERequestContext::ParseCommandBuffer(const Kernel::KHandleTable& handle_ta
rp.Skip(1, false); // The command is actually an u64, but we don't use the high part.
}
-Result HLERequestContext::PopulateFromIncomingCommandBuffer(
- const Kernel::KHandleTable& handle_table, u32_le* src_cmdbuf) {
- ParseCommandBuffer(handle_table, src_cmdbuf, true);
+Result HLERequestContext::PopulateFromIncomingCommandBuffer(Kernel::KProcess& process,
+ u32_le* src_cmdbuf) {
+ ParseCommandBuffer(process, src_cmdbuf, true);
if (command_header->IsCloseCommand()) {
// Close does not populate the rest of the IPC header
diff --git a/src/core/hle/service/hle_ipc.h b/src/core/hle/service/hle_ipc.h
index 4436f4f83..18d464c63 100644
--- a/src/core/hle/service/hle_ipc.h
+++ b/src/core/hle/service/hle_ipc.h
@@ -38,6 +38,7 @@ namespace Kernel {
class KAutoObject;
class KernelCore;
class KHandleTable;
+class KProcess;
class KServerSession;
class KThread;
} // namespace Kernel
@@ -195,8 +196,7 @@ public:
}
/// Populates this context with data from the requesting process/thread.
- Result PopulateFromIncomingCommandBuffer(const Kernel::KHandleTable& handle_table,
- u32_le* src_cmdbuf);
+ Result PopulateFromIncomingCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf);
/// Writes data from this context back to the requesting process/thread.
Result WriteToOutgoingCommandBuffer(Kernel::KThread& requesting_thread);
@@ -359,6 +359,10 @@ public:
return *thread;
}
+ Kernel::KHandleTable& GetClientHandleTable() {
+ return *client_handle_table;
+ }
+
[[nodiscard]] std::shared_ptr<SessionRequestManager> GetManager() const {
return manager.lock();
}
@@ -374,12 +378,12 @@ public:
private:
friend class IPC::ResponseBuilder;
- void ParseCommandBuffer(const Kernel::KHandleTable& handle_table, u32_le* src_cmdbuf,
- bool incoming);
+ void ParseCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf, bool incoming);
std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
Kernel::KServerSession* server_session{};
- Kernel::KThread* thread;
+ Kernel::KHandleTable* client_handle_table{};
+ Kernel::KThread* thread{};
std::vector<Handle> incoming_move_handles;
std::vector<Handle> incoming_copy_handles;