diff options
| author | 2018-01-24 23:09:03 -0500 | |
|---|---|---|
| committer | 2018-01-24 23:09:03 -0500 | |
| commit | 748c0de539674dc8ca4a5a8aadd2a61b0eabe652 (patch) | |
| tree | ae56efe8654d3aa3a5e75ec04bd9dfdcc06023a9 /src/core/hle/kernel/domain.cpp | |
| parent | audout:u OpenAudioOut and IAudioOut (#138) (diff) | |
| parent | audout_u: Various cleanups. (diff) | |
| download | yuzu-748c0de539674dc8ca4a5a8aadd2a61b0eabe652.tar.gz yuzu-748c0de539674dc8ca4a5a8aadd2a61b0eabe652.tar.xz yuzu-748c0de539674dc8ca4a5a8aadd2a61b0eabe652.zip | |
Merge pull request #137 from bunnei/improve-ipc
Improve IPC, unify Domains and Sessions, and add validation
Diffstat (limited to 'src/core/hle/kernel/domain.cpp')
| -rw-r--r-- | src/core/hle/kernel/domain.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/core/hle/kernel/domain.cpp b/src/core/hle/kernel/domain.cpp deleted file mode 100644 index 5035e9c08..000000000 --- a/src/core/hle/kernel/domain.cpp +++ /dev/null | |||
| @@ -1,63 +0,0 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/logging/log.h" | ||
| 6 | #include "core/hle/ipc_helpers.h" | ||
| 7 | #include "core/hle/kernel/client_port.h" | ||
| 8 | #include "core/hle/kernel/domain.h" | ||
| 9 | #include "core/hle/kernel/handle_table.h" | ||
| 10 | #include "core/hle/kernel/hle_ipc.h" | ||
| 11 | #include "core/hle/kernel/process.h" | ||
| 12 | #include "core/hle/kernel/session.h" | ||
| 13 | #include "core/hle/kernel/thread.h" | ||
| 14 | |||
| 15 | namespace Kernel { | ||
| 16 | |||
| 17 | ResultVal<SharedPtr<Domain>> Domain::Create(std::string name) { | ||
| 18 | SharedPtr<Domain> domain(new Domain); | ||
| 19 | domain->name = std::move(name); | ||
| 20 | return MakeResult(std::move(domain)); | ||
| 21 | } | ||
| 22 | |||
| 23 | ResultVal<SharedPtr<Domain>> Domain::CreateFromSession(const Session& session) { | ||
| 24 | auto res = Create(session.port->GetName() + "_Domain"); | ||
| 25 | auto& domain = res.Unwrap(); | ||
| 26 | domain->request_handlers.push_back(std::move(session.server->hle_handler)); | ||
| 27 | Kernel::g_handle_table.ConvertSessionToDomain(session, domain); | ||
| 28 | return res; | ||
| 29 | } | ||
| 30 | |||
| 31 | ResultCode Domain::SendSyncRequest(SharedPtr<Thread> thread) { | ||
| 32 | Kernel::HLERequestContext context(this); | ||
| 33 | u32* cmd_buf = (u32*)Memory::GetPointer(Kernel::GetCurrentThread()->GetTLSAddress()); | ||
| 34 | context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process, | ||
| 35 | Kernel::g_handle_table); | ||
| 36 | |||
| 37 | auto& domain_message_header = context.GetDomainMessageHeader(); | ||
| 38 | if (domain_message_header) { | ||
| 39 | // If there is a DomainMessageHeader, then this is CommandType "Request" | ||
| 40 | const u32 object_id{context.GetDomainMessageHeader()->object_id}; | ||
| 41 | switch (domain_message_header->command) { | ||
| 42 | case IPC::DomainMessageHeader::CommandType::SendMessage: | ||
| 43 | return request_handlers[object_id - 1]->HandleSyncRequest(context); | ||
| 44 | |||
| 45 | case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: { | ||
| 46 | LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x%08X", object_id); | ||
| 47 | |||
| 48 | request_handlers[object_id - 1] = nullptr; | ||
| 49 | |||
| 50 | IPC::RequestBuilder rb{context, 2}; | ||
| 51 | rb.Push(RESULT_SUCCESS); | ||
| 52 | |||
| 53 | return RESULT_SUCCESS; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | LOG_CRITICAL(IPC, "Unknown domain command=%d", domain_message_header->command.Value()); | ||
| 58 | UNIMPLEMENTED(); | ||
| 59 | } | ||
| 60 | return request_handlers.front()->HandleSyncRequest(context); | ||
| 61 | } | ||
| 62 | |||
| 63 | } // namespace Kernel | ||