ipc: Implement domain command CloseVirtualHandle.
This commit is contained in:
parent
d15cadd760
commit
30cb98f874
|
@ -143,6 +143,11 @@ struct DataPayloadHeader {
|
||||||
static_assert(sizeof(DataPayloadHeader) == 8, "DataPayloadRequest size is incorrect");
|
static_assert(sizeof(DataPayloadHeader) == 8, "DataPayloadRequest size is incorrect");
|
||||||
|
|
||||||
struct DomainMessageHeader {
|
struct DomainMessageHeader {
|
||||||
|
enum class CommandType : u32_le {
|
||||||
|
SendMessage = 1,
|
||||||
|
CloseVirtualHandle = 2,
|
||||||
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
// Used when responding to an IPC request, Server -> Client.
|
// Used when responding to an IPC request, Server -> Client.
|
||||||
struct {
|
struct {
|
||||||
|
@ -153,7 +158,7 @@ struct DomainMessageHeader {
|
||||||
// Used when performing an IPC request, Client -> Server.
|
// Used when performing an IPC request, Client -> Server.
|
||||||
struct {
|
struct {
|
||||||
union {
|
union {
|
||||||
BitField<0, 8, u32_le> command;
|
BitField<0, 8, CommandType> command;
|
||||||
BitField<16, 16, u32_le> size;
|
BitField<16, 16, u32_le> size;
|
||||||
};
|
};
|
||||||
u32_le object_id;
|
u32_le object_id;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/logging/log.h"
|
||||||
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/client_port.h"
|
#include "core/hle/kernel/client_port.h"
|
||||||
#include "core/hle/kernel/domain.h"
|
#include "core/hle/kernel/domain.h"
|
||||||
#include "core/hle/kernel/handle_table.h"
|
#include "core/hle/kernel/handle_table.h"
|
||||||
|
@ -36,7 +38,24 @@ ResultCode Domain::SendSyncRequest(SharedPtr<Thread> thread) {
|
||||||
if (domain_message_header) {
|
if (domain_message_header) {
|
||||||
// If there is a DomainMessageHeader, then this is CommandType "Request"
|
// If there is a DomainMessageHeader, then this is CommandType "Request"
|
||||||
const u32 object_id{context.GetDomainMessageHeader()->object_id};
|
const u32 object_id{context.GetDomainMessageHeader()->object_id};
|
||||||
|
switch (domain_message_header->command) {
|
||||||
|
case IPC::DomainMessageHeader::CommandType::SendMessage:
|
||||||
return request_handlers[object_id - 1]->HandleSyncRequest(context);
|
return request_handlers[object_id - 1]->HandleSyncRequest(context);
|
||||||
|
|
||||||
|
case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: {
|
||||||
|
LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x%08X", object_id);
|
||||||
|
|
||||||
|
request_handlers[object_id - 1] = nullptr;
|
||||||
|
|
||||||
|
IPC::RequestBuilder rb{context, 2};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
||||||
|
return RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_CRITICAL(IPC, "Unknown domain command=%d", domain_message_header->command.Value());
|
||||||
|
UNIMPLEMENTED();
|
||||||
}
|
}
|
||||||
return request_handlers.front()->HandleSyncRequest(context);
|
return request_handlers.front()->HandleSyncRequest(context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,13 +102,20 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
|
||||||
data_payload_header =
|
data_payload_header =
|
||||||
std::make_unique<IPC::DataPayloadHeader>(rp.PopRaw<IPC::DataPayloadHeader>());
|
std::make_unique<IPC::DataPayloadHeader>(rp.PopRaw<IPC::DataPayloadHeader>());
|
||||||
|
|
||||||
|
data_payload_offset = rp.GetCurrentOffset();
|
||||||
|
|
||||||
|
if (domain_message_header && domain_message_header->command ==
|
||||||
|
IPC::DomainMessageHeader::CommandType::CloseVirtualHandle) {
|
||||||
|
// CloseVirtualHandle command does not have SFC* or any data
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (incoming) {
|
if (incoming) {
|
||||||
ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'I'));
|
ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'I'));
|
||||||
} else {
|
} else {
|
||||||
ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O'));
|
ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O'));
|
||||||
}
|
}
|
||||||
|
|
||||||
data_payload_offset = rp.GetCurrentOffset();
|
|
||||||
command = rp.Pop<u32_le>();
|
command = rp.Pop<u32_le>();
|
||||||
rp.Skip(1, false); // The command is actually an u64, but we don't use the high part.
|
rp.Skip(1, false); // The command is actually an u64, but we don't use the high part.
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue