hle: kernel: Remove deprecated Object class.

This commit is contained in:
bunnei 2021-04-23 21:50:04 -07:00
commit bf380b8584
39 changed files with 34 additions and 423 deletions

View file

@ -232,8 +232,6 @@ add_library(core STATIC
hle/kernel/kernel.cpp
hle/kernel/kernel.h
hle/kernel/memory_types.h
hle/kernel/object.cpp
hle/kernel/object.h
hle/kernel/physical_core.cpp
hle/kernel/physical_core.h
hle/kernel/physical_memory.h

View file

@ -12,7 +12,6 @@
#include "common/common_types.h"
#include "core/file_sys/vfs_types.h"
#include "core/hle/kernel/object.h"
namespace Core::Frontend {
class EmuWindow;

View file

@ -16,7 +16,6 @@
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/k_client_port.h"
#include "core/hle/kernel/k_session.h"
#include "core/hle/kernel/object.h"
#include "core/hle/result.h"
namespace IPC {
@ -381,12 +380,6 @@ public:
template <typename T>
T PopRaw();
template <typename T>
T* GetMoveObject(std::size_t index);
template <typename T>
T* GetCopyObject(std::size_t index);
template <class T>
std::shared_ptr<T> PopIpcInterface() {
ASSERT(context->Session()->IsDomain());
@ -491,14 +484,4 @@ void RequestParser::Pop(First& first_value, Other&... other_values) {
Pop(other_values...);
}
template <typename T>
T* RequestParser::GetMoveObject(std::size_t index) {
return context->GetMoveObject<T>(index);
}
template <typename T>
T* RequestParser::GetCopyObject(std::size_t index) {
return context->GetCopyObject<T>(index);
}
} // namespace IPC

View file

@ -12,7 +12,6 @@
#include "core/hle/kernel/k_auto_object.h"
#include "core/hle/kernel/k_spin_lock.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h"
#include "core/hle/result.h"
namespace Kernel {

View file

@ -23,7 +23,6 @@
#include "core/hle/kernel/k_thread.h"
#include "core/hle/kernel/k_writable_event.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/process.h"
#include "core/hle/kernel/svc_results.h"
#include "core/hle/kernel/time_manager.h"

View file

@ -212,16 +212,6 @@ public:
return move_handles.at(index);
}
template <typename T>
T* GetCopyObject(std::size_t index) {
return DynamicObjectCast<T>(copy_objects.at(index));
}
template <typename T>
T* GetMoveObject(std::size_t index) {
return DynamicObjectCast<T>(move_objects.at(index));
}
void AddMoveObject(KAutoObject* object) {
move_objects.emplace_back(object);
}

View file

@ -11,13 +11,14 @@
#include "common/common_types.h"
#include "common/intrusive_red_black_tree.h"
#include "core/hle/kernel/k_class_token.h"
#include "core/hle/kernel/object.h"
namespace Kernel {
class KernelCore;
class Process;
using Handle = u32;
#define KERNEL_AUTOOBJECT_TRAITS(CLASS, BASE_CLASS) \
NON_COPYABLE(CLASS); \
NON_MOVEABLE(CLASS); \
@ -48,7 +49,7 @@ public:
\
private:
class KAutoObject : public Object {
class KAutoObject {
protected:
class TypeObj {
private:
@ -84,16 +85,17 @@ private:
KERNEL_AUTOOBJECT_TRAITS(KAutoObject, KAutoObject);
private:
std::atomic<u32> m_ref_count;
std::atomic<u32> m_ref_count{};
protected:
KernelCore& kernel;
std::string name;
public:
static KAutoObject* Create(KAutoObject* ptr);
public:
explicit KAutoObject(KernelCore& kernel_) : Object{kernel_}, m_ref_count(0), kernel(kernel_) {}
explicit KAutoObject(KernelCore& kernel_) : kernel(kernel_) {}
virtual ~KAutoObject() {}
// Destroy is responsible for destroying the auto object's resources when ref_count hits zero.
@ -205,6 +207,10 @@ public:
virtual u64 GetId() const {
return reinterpret_cast<u64>(this);
}
virtual const std::string& GetName() const {
return name;
}
};
template <typename T>

View file

@ -51,26 +51,11 @@ public:
ResultCode CreateSession(KClientSession** out);
// DEPRECATED
std::string GetTypeName() const override {
return "ClientPort";
}
std::string GetName() const override {
return name;
}
static constexpr HandleType HANDLE_TYPE = HandleType::ClientPort;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
private:
std::atomic<s32> num_sessions{};
std::atomic<s32> peak_sessions{};
s32 max_sessions{};
KPort* parent{};
std::string name;
};
} // namespace Kernel

View file

@ -54,27 +54,8 @@ public:
void OnServerClosed();
// DEPRECATED
static constexpr HandleType HANDLE_TYPE = HandleType::ClientSession;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
std::string GetTypeName() const override {
return "ClientSession";
}
std::string GetName() const override {
return name;
}
private:
/// The parent session, which links to the server endpoint.
KSession* parent{};
/// Name of the client session (optional)
std::string name;
};
} // namespace Kernel

View file

@ -48,17 +48,6 @@ public:
return writable_event;
}
// DEPRECATED
std::string GetTypeName() const override {
return "KEvent";
}
static constexpr HandleType HANDLE_TYPE = HandleType::Event;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
private:
KReadableEvent readable_event;
KWritableEvent writable_event;

View file

@ -51,22 +51,6 @@ public:
return server;
}
// DEPRECATED
friend class ServerPort;
std::string GetTypeName() const override {
return "Port";
}
std::string GetName() const override {
return name;
}
HandleType GetHandleType() const override {
return {};
}
void Finalize() override {}
private:
enum class State : u8 {
Invalid = 0,
@ -80,8 +64,6 @@ private:
KClientPort client;
State state{State::Invalid};
bool is_light{};
std::string name; ///< Name of client port (optional)
};
} // namespace Kernel

View file

@ -6,7 +6,6 @@
#include "core/hle/kernel/k_auto_object.h"
#include "core/hle/kernel/k_synchronization_object.h"
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/slab_helpers.h"
#include "core/hle/result.h"
@ -39,17 +38,6 @@ public:
ResultCode Clear();
ResultCode Reset();
// DEPRECATED
std::string GetTypeName() const override {
return "KReadableEvent";
}
static constexpr HandleType HANDLE_TYPE = HandleType::ReadableEvent;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
private:
bool is_signaled{};
KEvent* parent{};

View file

@ -8,7 +8,6 @@
#include "common/common_types.h"
#include "core/hle/kernel/k_light_condition_variable.h"
#include "core/hle/kernel/k_light_lock.h"
#include "core/hle/kernel/object.h"
union ResultCode;
@ -57,20 +56,6 @@ public:
static void PostDestroy([[maybe_unused]] uintptr_t arg) {}
// DEPRECATED
std::string GetTypeName() const override {
return "KResourceLimit";
}
std::string GetName() const override {
return GetTypeName();
}
static constexpr HandleType HANDLE_TYPE = HandleType::ResourceLimit;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
private:
using ResourceArray = std::array<s64, static_cast<std::size_t>(LimitableResource::Count)>;
ResourceArray limit_values{};

View file

@ -10,7 +10,6 @@
#include "core/hle/kernel/k_server_port.h"
#include "core/hle/kernel/k_server_session.h"
#include "core/hle/kernel/k_thread.h"
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/svc_results.h"
namespace Kernel {

View file

@ -68,20 +68,6 @@ public:
virtual void Destroy() override;
virtual bool IsSignaled() const override;
// DEPRECATED
std::string GetTypeName() const override {
return "ServerPort";
}
std::string GetName() const override {
return name;
}
static constexpr HandleType HANDLE_TYPE = HandleType::ServerPort;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
private:
void CleanupSessions();
@ -89,7 +75,6 @@ private:
SessionList session_list;
HLEHandler hle_handler;
KPort* parent{};
std::string name;
};
} // namespace Kernel

View file

@ -103,21 +103,6 @@ public:
convert_to_domain = true;
}
// DEPRECATED
std::string GetTypeName() const override {
return "ServerSession";
}
std::string GetName() const override {
return name;
}
static constexpr HandleType HANDLE_TYPE = HandleType::ServerSession;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
private:
/// Queues a sync request from the emulated application.
ResultCode QueueSyncRequest(KThread* thread, Core::Memory::Memory& memory);
@ -138,9 +123,6 @@ private:
/// When set to True, converts the session to a domain at the end of the command
bool convert_to_domain{};
/// The name of this session (optional)
std::string name;
/// Thread to dispatch service requests
std::weak_ptr<ServiceThread> service_thread;

View file

@ -15,7 +15,7 @@ KSession::KSession(KernelCore& kernel)
: KAutoObjectWithSlabHeapAndContainer{kernel}, server{kernel}, client{kernel} {}
KSession::~KSession() = default;
void KSession::Initialize(KClientPort* port_, std::string&& name_) {
void KSession::Initialize(KClientPort* port_, const std::string& name_) {
// Increment reference count.
// Because reference count is one on creation, this will result
// in a reference count of two. Thus, when both server and client are closed
@ -32,7 +32,7 @@ void KSession::Initialize(KClientPort* port_, std::string&& name_) {
// Set state and name.
SetState(State::Normal);
name = std::move(name_);
name = name_;
// Set our owner process.
process = kernel.CurrentProcess();

View file

@ -28,7 +28,7 @@ public:
explicit KSession(KernelCore& kernel);
virtual ~KSession() override;
void Initialize(KClientPort* port_, std::string&& name_);
void Initialize(KClientPort* port_, const std::string& name_);
virtual void Finalize() override;
@ -74,17 +74,6 @@ public:
return port;
}
// DEPRECATED
std::string GetName() const override {
return name;
}
static constexpr HandleType HANDLE_TYPE = HandleType::Session;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
private:
void SetState(State state) {
atomic_state = static_cast<u8>(state);
@ -100,7 +89,6 @@ private:
std::atomic<std::underlying_type<State>::type> atomic_state{
static_cast<std::underlying_type<State>::type>(State::Invalid)};
KClientPort* port{};
std::string name;
Process* process{};
bool initialized{};
};

View file

@ -32,19 +32,6 @@ public:
KMemoryPermission owner_permission_, KMemoryPermission user_permission_,
PAddr physical_address_, std::size_t size_, std::string name_);
std::string GetTypeName() const override {
return "SharedMemory";
}
std::string GetName() const override {
return name;
}
static constexpr HandleType HANDLE_TYPE = HandleType::SharedMemory;
HandleType GetHandleType() const override {
return HANDLE_TYPE;
}
/**
* Maps a shared memory block to an address in the target process' address space
* @param target_process Process on which to map the memory block

View file

@ -51,13 +51,4 @@ private:
ThreadListNode* thread_list_tail{};
};
// Specialization of DynamicObjectCast for KSynchronizationObjects
template <>
inline KSynchronizationObject* DynamicObjectCast<KSynchronizationObject>(Object* object) {
if (object != nullptr && object->IsWaitable()) {
return reinterpret_cast<KSynchronizationObject*>(object);
}
return nullptr;
}
} // namespace Kernel

Some files were not shown because too many files have changed in this diff Show more