mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
hle: Remove Domain and SyncObject kernel objects.
This commit is contained in:
parent
932fa94af7
commit
67758857e4
10 changed files with 2 additions and 169 deletions
|
@ -36,8 +36,6 @@ add_library(core STATIC
|
||||||
hle/kernel/client_session.h
|
hle/kernel/client_session.h
|
||||||
hle/kernel/condition_variable.cpp
|
hle/kernel/condition_variable.cpp
|
||||||
hle/kernel/condition_variable.h
|
hle/kernel/condition_variable.h
|
||||||
hle/kernel/domain.cpp
|
|
||||||
hle/kernel/domain.h
|
|
||||||
hle/kernel/errors.h
|
hle/kernel/errors.h
|
||||||
hle/kernel/event.cpp
|
hle/kernel/event.cpp
|
||||||
hle/kernel/event.h
|
hle/kernel/event.h
|
||||||
|
@ -67,7 +65,6 @@ add_library(core STATIC
|
||||||
hle/kernel/svc.cpp
|
hle/kernel/svc.cpp
|
||||||
hle/kernel/svc.h
|
hle/kernel/svc.h
|
||||||
hle/kernel/svc_wrap.h
|
hle/kernel/svc_wrap.h
|
||||||
hle/kernel/sync_object.h
|
|
||||||
hle/kernel/thread.cpp
|
hle/kernel/thread.cpp
|
||||||
hle/kernel/thread.h
|
hle/kernel/thread.h
|
||||||
hle/kernel/timer.cpp
|
hle/kernel/timer.cpp
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "core/hle/ipc.h"
|
#include "core/hle/ipc.h"
|
||||||
#include "core/hle/kernel/client_port.h"
|
#include "core/hle/kernel/client_port.h"
|
||||||
#include "core/hle/kernel/client_session.h"
|
#include "core/hle/kernel/client_session.h"
|
||||||
#include "core/hle/kernel/domain.h"
|
|
||||||
#include "core/hle/kernel/handle_table.h"
|
#include "core/hle/kernel/handle_table.h"
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/kernel/hle_ipc.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/kernel/sync_object.h"
|
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
@ -16,7 +15,7 @@ class ServerSession;
|
||||||
class Session;
|
class Session;
|
||||||
class Thread;
|
class Thread;
|
||||||
|
|
||||||
class ClientSession final : public SyncObject {
|
class ClientSession final : public Object {
|
||||||
public:
|
public:
|
||||||
friend class ServerSession;
|
friend class ServerSession;
|
||||||
|
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
// Copyright 2018 yuzu emulator team
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// 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/domain.h"
|
|
||||||
#include "core/hle/kernel/handle_table.h"
|
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
|
||||||
#include "core/hle/kernel/process.h"
|
|
||||||
#include "core/hle/kernel/session.h"
|
|
||||||
#include "core/hle/kernel/thread.h"
|
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
ResultVal<SharedPtr<Domain>> Domain::Create(std::string name) {
|
|
||||||
SharedPtr<Domain> domain(new Domain);
|
|
||||||
domain->name = std::move(name);
|
|
||||||
return MakeResult(std::move(domain));
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultVal<SharedPtr<Domain>> Domain::CreateFromSession(const Session& session) {
|
|
||||||
auto res = Create(session.port->GetName() + "_Domain");
|
|
||||||
auto& domain = res.Unwrap();
|
|
||||||
domain->request_handlers.push_back(std::move(session.server->hle_handler));
|
|
||||||
Kernel::g_handle_table.ConvertSessionToDomain(session, domain);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultCode Domain::SendSyncRequest(SharedPtr<Thread> thread) {
|
|
||||||
Kernel::HLERequestContext context(this);
|
|
||||||
u32* cmd_buf = (u32*)Memory::GetPointer(Kernel::GetCurrentThread()->GetTLSAddress());
|
|
||||||
context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
|
||||||
Kernel::g_handle_table);
|
|
||||||
|
|
||||||
auto& domain_message_header = context.GetDomainMessageHeader();
|
|
||||||
if (domain_message_header) {
|
|
||||||
// If there is a DomainMessageHeader, then this is CommandType "Request"
|
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Kernel
|
|
|
@ -1,45 +0,0 @@
|
||||||
// Copyright 2018 yuzu emulator team
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "core/hle/kernel/sync_object.h"
|
|
||||||
#include "core/hle/result.h"
|
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
class Session;
|
|
||||||
class SessionRequestHandler;
|
|
||||||
|
|
||||||
class Domain final : public SyncObject {
|
|
||||||
public:
|
|
||||||
std::string GetTypeName() const override {
|
|
||||||
return "Domain";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const HandleType HANDLE_TYPE = HandleType::Domain;
|
|
||||||
HandleType GetHandleType() const override {
|
|
||||||
return HANDLE_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ResultVal<SharedPtr<Domain>> CreateFromSession(const Session& server);
|
|
||||||
|
|
||||||
ResultCode SendSyncRequest(SharedPtr<Thread> thread) override;
|
|
||||||
|
|
||||||
/// The name of this domain (optional)
|
|
||||||
std::string name;
|
|
||||||
|
|
||||||
std::vector<std::shared_ptr<SessionRequestHandler>> request_handlers;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Domain() = default;
|
|
||||||
~Domain() override = default;
|
|
||||||
|
|
||||||
static ResultVal<SharedPtr<Domain>> Create(std::string name = "Unknown");
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Kernel
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/domain.h"
|
|
||||||
#include "core/hle/kernel/handle_table.h"
|
#include "core/hle/kernel/handle_table.h"
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/kernel/hle_ipc.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
|
|
|
@ -31,7 +31,6 @@ enum class HandleType : u32 {
|
||||||
ServerPort,
|
ServerPort,
|
||||||
ClientSession,
|
ClientSession,
|
||||||
ServerSession,
|
ServerSession,
|
||||||
Domain,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -84,27 +83,12 @@ public:
|
||||||
case HandleType::CodeSet:
|
case HandleType::CodeSet:
|
||||||
case HandleType::ClientPort:
|
case HandleType::ClientPort:
|
||||||
case HandleType::ClientSession:
|
case HandleType::ClientSession:
|
||||||
case HandleType::Domain:
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if svcSendSyncRequest can be called on the object
|
|
||||||
* @return True svcSendSyncRequest can be called on the object, otherwise false
|
|
||||||
*/
|
|
||||||
bool IsSyncable() const {
|
|
||||||
switch (GetHandleType()) {
|
|
||||||
case HandleType::ClientSession:
|
|
||||||
case HandleType::Domain:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static unsigned int next_object_id;
|
static unsigned int next_object_id;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "core/hle/kernel/shared_memory.h"
|
#include "core/hle/kernel/shared_memory.h"
|
||||||
#include "core/hle/kernel/svc.h"
|
#include "core/hle/kernel/svc.h"
|
||||||
#include "core/hle/kernel/svc_wrap.h"
|
#include "core/hle/kernel/svc_wrap.h"
|
||||||
#include "core/hle/kernel/sync_object.h"
|
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
#include "core/hle/lock.h"
|
#include "core/hle/lock.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
@ -87,7 +86,7 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address
|
||||||
|
|
||||||
/// Makes a blocking IPC call to an OS service.
|
/// Makes a blocking IPC call to an OS service.
|
||||||
static ResultCode SendSyncRequest(Handle handle) {
|
static ResultCode SendSyncRequest(Handle handle) {
|
||||||
SharedPtr<SyncObject> session = g_handle_table.Get<SyncObject>(handle);
|
SharedPtr<ClientSession> session = g_handle_table.Get<ClientSession>(handle);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
LOG_ERROR(Kernel_SVC, "called with invalid handle=0x%08X", handle);
|
LOG_ERROR(Kernel_SVC, "called with invalid handle=0x%08X", handle);
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
// Copyright 2018 yuzu emulator team
|
|
||||||
// Licensed under GPLv2 or any later version
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <boost/smart_ptr/intrusive_ptr.hpp>
|
|
||||||
#include "core/hle/kernel/kernel.h"
|
|
||||||
#include "core/hle/result.h"
|
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
class Thread;
|
|
||||||
|
|
||||||
/// Class that represents a Kernel object that svcSendSyncRequest can be called on
|
|
||||||
class SyncObject : public Object {
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Handle a sync request from the emulated application.
|
|
||||||
* @param thread Thread that initiated the request.
|
|
||||||
* @returns ResultCode from the operation.
|
|
||||||
*/
|
|
||||||
virtual ResultCode SendSyncRequest(SharedPtr<Thread> thread) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Specialization of DynamicObjectCast for SyncObjects
|
|
||||||
template <>
|
|
||||||
inline SharedPtr<SyncObject> DynamicObjectCast<SyncObject>(SharedPtr<Object> object) {
|
|
||||||
if (object != nullptr && object->IsSyncable()) {
|
|
||||||
return boost::static_pointer_cast<SyncObject>(std::move(object));
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Kernel
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/domain.h"
|
|
||||||
#include "core/hle/service/sm/controller.h"
|
#include "core/hle/service/sm/controller.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
|
Loading…
Reference in a new issue