summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp23
-rw-r--r--src/core/hle/kernel/hle_ipc.h3
-rw-r--r--src/core/hle/kernel/server_session.h10
3 files changed, 31 insertions, 5 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index b7070af03..35cac68f1 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -4,6 +4,7 @@
#include <boost/range/algorithm_ext/erase.hpp>
#include "common/assert.h"
+#include "common/common_funcs.h"
#include "common/common_types.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/handle_table.h"
@@ -45,10 +46,15 @@ void HLERequestContext::ClearIncomingObjects() {
request_handles.clear();
}
-void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf) {
+void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
IPC::RequestParser rp(src_cmdbuf);
command_header = std::make_unique<IPC::CommandHeader>(rp.PopRaw<IPC::CommandHeader>());
+ if (command_header->type == IPC::CommandType::Close) {
+ // Close does not populate the rest of the IPC header
+ return;
+ }
+
// If handle descriptor is present, add size of it
if (command_header->enable_handle_descriptor) {
handle_descriptor_header =
@@ -80,9 +86,18 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf) {
UNIMPLEMENTED();
}
+ if (incoming && Session()->IsDomain()) {
+ domain_message_header = std::make_unique<IPC::DomainMessageHeader>(rp.PopRaw<IPC::DomainMessageHeader>());
+ }
+
data_payload_header =
std::make_unique<IPC::DataPayloadHeader>(rp.PopRaw<IPC::DataPayloadHeader>());
- ASSERT(data_payload_header->magic == 0x49434653 || data_payload_header->magic == 0x4F434653);
+
+ if (incoming) {
+ ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'I'));
+ } else {
+ ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O'));
+ }
data_payload_offset = rp.GetCurrentOffset();
command = rp.Pop<u32_le>();
@@ -91,7 +106,7 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf) {
ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf,
Process& src_process,
HandleTable& src_table) {
- ParseCommandBuffer(src_cmdbuf);
+ ParseCommandBuffer(src_cmdbuf, true);
size_t untranslated_size = data_payload_offset + command_header->data_size;
std::copy_n(src_cmdbuf, untranslated_size, cmd_buf.begin());
@@ -106,7 +121,7 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdb
ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process,
HandleTable& dst_table) {
- ParseCommandBuffer(&cmd_buf[0]);
+ ParseCommandBuffer(&cmd_buf[0], false);
size_t untranslated_size = data_payload_offset + command_header->data_size;
std::copy_n(cmd_buf.begin(), untranslated_size, dst_cmdbuf);
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 32a528968..17baffc06 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -119,7 +119,7 @@ public:
*/
void ClearIncomingObjects();
- void ParseCommandBuffer(u32_le* src_cmdbuf);
+ void ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming);
/// Populates this context with data from the requesting process/thread.
ResultCode PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf, Process& src_process,
@@ -149,6 +149,7 @@ private:
std::unique_ptr<IPC::CommandHeader> command_header;
std::unique_ptr<IPC::HandleDescriptorHeader> handle_descriptor_header;
std::unique_ptr<IPC::DataPayloadHeader> data_payload_header;
+ std::unique_ptr<IPC::DomainMessageHeader> domain_message_header;
unsigned data_payload_offset{};
u32_le command{};
diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h
index f4360ddf3..78db5510d 100644
--- a/src/core/hle/kernel/server_session.h
+++ b/src/core/hle/kernel/server_session.h
@@ -91,6 +91,14 @@ public:
/// TODO(Subv): Find a better name for this.
SharedPtr<Thread> currently_handling;
+ void ConvertToDomain() {
+ is_domain = true;
+ }
+
+ bool IsDomain() const {
+ return is_domain;
+ }
+
private:
ServerSession();
~ServerSession() override;
@@ -102,6 +110,8 @@ private:
* @return The created server session
*/
static ResultVal<SharedPtr<ServerSession>> Create(std::string name = "Unknown");
+
+ bool is_domain{};
};
/**