diff options
| author | 2018-01-23 16:13:19 -0500 | |
|---|---|---|
| committer | 2018-01-24 22:18:54 -0500 | |
| commit | 67758857e4203cebc9a5815c6b0293c0aad0e598 (patch) | |
| tree | 6d39ebcb39695f3117864416c56d16edb4611514 /src | |
| parent | handle_table: Remove ConvertSessionToDomain. (diff) | |
| download | yuzu-67758857e4203cebc9a5815c6b0293c0aad0e598.tar.gz yuzu-67758857e4203cebc9a5815c6b0293c0aad0e598.tar.xz yuzu-67758857e4203cebc9a5815c6b0293c0aad0e598.zip | |
hle: Remove Domain and SyncObject kernel objects.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/core/hle/ipc_helpers.h | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/client_session.h | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/domain.cpp | 63 | ||||
| -rw-r--r-- | src/core/hle/kernel/domain.h | 45 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 16 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/sync_object.h | 35 | ||||
| -rw-r--r-- | src/core/hle/service/sm/controller.cpp | 1 |
10 files changed, 2 insertions, 169 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 242c2db0c..70547c8b2 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -36,8 +36,6 @@ add_library(core STATIC | |||
| 36 | hle/kernel/client_session.h | 36 | hle/kernel/client_session.h |
| 37 | hle/kernel/condition_variable.cpp | 37 | hle/kernel/condition_variable.cpp |
| 38 | hle/kernel/condition_variable.h | 38 | hle/kernel/condition_variable.h |
| 39 | hle/kernel/domain.cpp | ||
| 40 | hle/kernel/domain.h | ||
| 41 | hle/kernel/errors.h | 39 | hle/kernel/errors.h |
| 42 | hle/kernel/event.cpp | 40 | hle/kernel/event.cpp |
| 43 | hle/kernel/event.h | 41 | hle/kernel/event.h |
| @@ -67,7 +65,6 @@ add_library(core STATIC | |||
| 67 | hle/kernel/svc.cpp | 65 | hle/kernel/svc.cpp |
| 68 | hle/kernel/svc.h | 66 | hle/kernel/svc.h |
| 69 | hle/kernel/svc_wrap.h | 67 | hle/kernel/svc_wrap.h |
| 70 | hle/kernel/sync_object.h | ||
| 71 | hle/kernel/thread.cpp | 68 | hle/kernel/thread.cpp |
| 72 | hle/kernel/thread.h | 69 | hle/kernel/thread.h |
| 73 | hle/kernel/timer.cpp | 70 | hle/kernel/timer.cpp |
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index ab479b49b..e5c26e079 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include "core/hle/ipc.h" | 11 | #include "core/hle/ipc.h" |
| 12 | #include "core/hle/kernel/client_port.h" | 12 | #include "core/hle/kernel/client_port.h" |
| 13 | #include "core/hle/kernel/client_session.h" | 13 | #include "core/hle/kernel/client_session.h" |
| 14 | #include "core/hle/kernel/domain.h" | ||
| 15 | #include "core/hle/kernel/handle_table.h" | 14 | #include "core/hle/kernel/handle_table.h" |
| 16 | #include "core/hle/kernel/hle_ipc.h" | 15 | #include "core/hle/kernel/hle_ipc.h" |
| 17 | #include "core/hle/kernel/kernel.h" | 16 | #include "core/hle/kernel/kernel.h" |
diff --git a/src/core/hle/kernel/client_session.h b/src/core/hle/kernel/client_session.h index d6ab4f893..f2765cc1e 100644 --- a/src/core/hle/kernel/client_session.h +++ b/src/core/hle/kernel/client_session.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/hle/kernel/sync_object.h" | ||
| 11 | #include "core/hle/result.h" | 10 | #include "core/hle/result.h" |
| 12 | 11 | ||
| 13 | namespace Kernel { | 12 | namespace Kernel { |
| @@ -16,7 +15,7 @@ class ServerSession; | |||
| 16 | class Session; | 15 | class Session; |
| 17 | class Thread; | 16 | class Thread; |
| 18 | 17 | ||
| 19 | class ClientSession final : public SyncObject { | 18 | class ClientSession final : public Object { |
| 20 | public: | 19 | public: |
| 21 | friend class ServerSession; | 20 | friend class ServerSession; |
| 22 | 21 | ||
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 | ||
diff --git a/src/core/hle/kernel/domain.h b/src/core/hle/kernel/domain.h deleted file mode 100644 index 3fec3b0b2..000000000 --- a/src/core/hle/kernel/domain.h +++ /dev/null | |||
| @@ -1,45 +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 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include <string> | ||
| 9 | #include <vector> | ||
| 10 | #include "core/hle/kernel/sync_object.h" | ||
| 11 | #include "core/hle/result.h" | ||
| 12 | |||
| 13 | namespace Kernel { | ||
| 14 | |||
| 15 | class Session; | ||
| 16 | class SessionRequestHandler; | ||
| 17 | |||
| 18 | class Domain final : public SyncObject { | ||
| 19 | public: | ||
| 20 | std::string GetTypeName() const override { | ||
| 21 | return "Domain"; | ||
| 22 | } | ||
| 23 | |||
| 24 | static const HandleType HANDLE_TYPE = HandleType::Domain; | ||
| 25 | HandleType GetHandleType() const override { | ||
| 26 | return HANDLE_TYPE; | ||
| 27 | } | ||
| 28 | |||
| 29 | static ResultVal<SharedPtr<Domain>> CreateFromSession(const Session& server); | ||
| 30 | |||
| 31 | ResultCode SendSyncRequest(SharedPtr<Thread> thread) override; | ||
| 32 | |||
| 33 | /// The name of this domain (optional) | ||
| 34 | std::string name; | ||
| 35 | |||
| 36 | std::vector<std::shared_ptr<SessionRequestHandler>> request_handlers; | ||
| 37 | |||
| 38 | private: | ||
| 39 | Domain() = default; | ||
| 40 | ~Domain() override = default; | ||
| 41 | |||
| 42 | static ResultVal<SharedPtr<Domain>> Create(std::string name = "Unknown"); | ||
| 43 | }; | ||
| 44 | |||
| 45 | } // namespace Kernel | ||
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index ecf32c18a..2cd6de12e 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include "common/common_funcs.h" | 7 | #include "common/common_funcs.h" |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/ipc_helpers.h" | 9 | #include "core/hle/ipc_helpers.h" |
| 10 | #include "core/hle/kernel/domain.h" | ||
| 11 | #include "core/hle/kernel/handle_table.h" | 10 | #include "core/hle/kernel/handle_table.h" |
| 12 | #include "core/hle/kernel/hle_ipc.h" | 11 | #include "core/hle/kernel/hle_ipc.h" |
| 13 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/kernel.h" |
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 4d9549e45..c77e58f3c 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -31,7 +31,6 @@ enum class HandleType : u32 { | |||
| 31 | ServerPort, | 31 | ServerPort, |
| 32 | ClientSession, | 32 | ClientSession, |
| 33 | ServerSession, | 33 | ServerSession, |
| 34 | Domain, | ||
| 35 | }; | 34 | }; |
| 36 | 35 | ||
| 37 | enum { | 36 | enum { |
| @@ -84,27 +83,12 @@ public: | |||
| 84 | case HandleType::CodeSet: | 83 | case HandleType::CodeSet: |
| 85 | case HandleType::ClientPort: | 84 | case HandleType::ClientPort: |
| 86 | case HandleType::ClientSession: | 85 | case HandleType::ClientSession: |
| 87 | case HandleType::Domain: | ||
| 88 | return false; | 86 | return false; |
| 89 | } | 87 | } |
| 90 | 88 | ||
| 91 | UNREACHABLE(); | 89 | UNREACHABLE(); |
| 92 | } | 90 | } |
| 93 | 91 | ||
| 94 | /** | ||
| 95 | * Check if svcSendSyncRequest can be called on the object | ||
| 96 | * @return True svcSendSyncRequest can be called on the object, otherwise false | ||
| 97 | */ | ||
| 98 | bool IsSyncable() const { | ||
| 99 | switch (GetHandleType()) { | ||
| 100 | case HandleType::ClientSession: | ||
| 101 | case HandleType::Domain: | ||
| 102 | return true; | ||
| 103 | } | ||
| 104 | |||
| 105 | UNREACHABLE(); | ||
| 106 | } | ||
| 107 | |||
| 108 | public: | 92 | public: |
| 109 | static unsigned int next_object_id; | 93 | static unsigned int next_object_id; |
| 110 | 94 | ||
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 516309036..4c0276cf0 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include "core/hle/kernel/shared_memory.h" | 20 | #include "core/hle/kernel/shared_memory.h" |
| 21 | #include "core/hle/kernel/svc.h" | 21 | #include "core/hle/kernel/svc.h" |
| 22 | #include "core/hle/kernel/svc_wrap.h" | 22 | #include "core/hle/kernel/svc_wrap.h" |
| 23 | #include "core/hle/kernel/sync_object.h" | ||
| 24 | #include "core/hle/kernel/thread.h" | 23 | #include "core/hle/kernel/thread.h" |
| 25 | #include "core/hle/lock.h" | 24 | #include "core/hle/lock.h" |
| 26 | #include "core/hle/result.h" | 25 | #include "core/hle/result.h" |
| @@ -87,7 +86,7 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address | |||
| 87 | 86 | ||
| 88 | /// Makes a blocking IPC call to an OS service. | 87 | /// Makes a blocking IPC call to an OS service. |
| 89 | static ResultCode SendSyncRequest(Handle handle) { | 88 | static ResultCode SendSyncRequest(Handle handle) { |
| 90 | SharedPtr<SyncObject> session = g_handle_table.Get<SyncObject>(handle); | 89 | SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle); |
| 91 | if (!session) { | 90 | if (!session) { |
| 92 | LOG_ERROR(Kernel_SVC, "called with invalid handle=0x%08X", handle); | 91 | LOG_ERROR(Kernel_SVC, "called with invalid handle=0x%08X", handle); |
| 93 | return ERR_INVALID_HANDLE; | 92 | return ERR_INVALID_HANDLE; |
diff --git a/src/core/hle/kernel/sync_object.h b/src/core/hle/kernel/sync_object.h deleted file mode 100644 index f2befa2ea..000000000 --- a/src/core/hle/kernel/sync_object.h +++ /dev/null | |||
| @@ -1,35 +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 | #pragma once | ||
| 6 | |||
| 7 | #include <boost/smart_ptr/intrusive_ptr.hpp> | ||
| 8 | #include "core/hle/kernel/kernel.h" | ||
| 9 | #include "core/hle/result.h" | ||
| 10 | |||
| 11 | namespace Kernel { | ||
| 12 | |||
| 13 | class Thread; | ||
| 14 | |||
| 15 | /// Class that represents a Kernel object that svcSendSyncRequest can be called on | ||
| 16 | class SyncObject : public Object { | ||
| 17 | public: | ||
| 18 | /** | ||
| 19 | * Handle a sync request from the emulated application. | ||
| 20 | * @param thread Thread that initiated the request. | ||
| 21 | * @returns ResultCode from the operation. | ||
| 22 | */ | ||
| 23 | virtual ResultCode SendSyncRequest(SharedPtr<Thread> thread) = 0; | ||
| 24 | }; | ||
| 25 | |||
| 26 | // Specialization of DynamicObjectCast for SyncObjects | ||
| 27 | template <> | ||
| 28 | inline SharedPtr<SyncObject> DynamicObjectCast<SyncObject>(SharedPtr<Object> object) { | ||
| 29 | if (object != nullptr && object->IsSyncable()) { | ||
| 30 | return boost::static_pointer_cast<SyncObject>(std::move(object)); | ||
| 31 | } | ||
| 32 | return nullptr; | ||
| 33 | } | ||
| 34 | |||
| 35 | } // namespace Kernel | ||
diff --git a/src/core/hle/service/sm/controller.cpp b/src/core/hle/service/sm/controller.cpp index 7b1c8ee37..e91d9d856 100644 --- a/src/core/hle/service/sm/controller.cpp +++ b/src/core/hle/service/sm/controller.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/hle/ipc_helpers.h" | 6 | #include "core/hle/ipc_helpers.h" |
| 7 | #include "core/hle/kernel/domain.h" | ||
| 8 | #include "core/hle/service/sm/controller.h" | 7 | #include "core/hle/service/sm/controller.h" |
| 9 | 8 | ||
| 10 | namespace Service { | 9 | namespace Service { |