mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-11-30 17:29:08 +00:00
hle: kernel: Remove deprecated Object class.
This commit is contained in:
parent
864841eb9e
commit
bf380b8584
39 changed files with 34 additions and 423 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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{};
|
||||
|
|
|
@ -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{};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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{};
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/k_thread_queue.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"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "core/hle/kernel/k_light_lock.h"
|
||||
#include "core/hle/kernel/k_spin_lock.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/kernel/svc_common.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
|
@ -120,23 +119,10 @@ public:
|
|||
using ThreadContext64 = Core::ARM_Interface::ThreadContext64;
|
||||
using WaiterList = boost::intrusive::list<KThread>;
|
||||
|
||||
[[nodiscard]] std::string GetName() const override {
|
||||
return name;
|
||||
}
|
||||
|
||||
void SetName(std::string new_name) {
|
||||
name = std::move(new_name);
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string GetTypeName() const override {
|
||||
return "Thread";
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::Thread;
|
||||
[[nodiscard]] HandleType GetHandleType() const override {
|
||||
return HANDLE_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the thread's current priority
|
||||
* @return The current thread's priority
|
||||
|
@ -728,7 +714,6 @@ private:
|
|||
VAddr mutex_wait_address_for_debugging{};
|
||||
ThreadWaitReasonForDebugging wait_reason_for_debugging{};
|
||||
ThreadType thread_type_for_debugging{};
|
||||
std::string name;
|
||||
|
||||
public:
|
||||
using ConditionVariableThreadTreeType = ConditionVariableThreadTree;
|
||||
|
|
|
@ -55,21 +55,6 @@ public:
|
|||
return is_initialized ? size * PageSize : 0;
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
|
||||
std::string GetTypeName() const override {
|
||||
return "TransferMemory";
|
||||
}
|
||||
|
||||
std::string GetName() const override {
|
||||
return GetTypeName();
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::TransferMemory;
|
||||
HandleType GetHandleType() const override {
|
||||
return HANDLE_TYPE;
|
||||
}
|
||||
|
||||
private:
|
||||
Process* owner{};
|
||||
VAddr address{};
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "core/hle/kernel/k_auto_object.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/slab_helpers.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
|
@ -34,17 +33,6 @@ public:
|
|||
return parent;
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
|
||||
std::string GetTypeName() const override {
|
||||
return "KWritableEvent";
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::WritableEvent;
|
||||
HandleType GetHandleType() const override {
|
||||
return HANDLE_TYPE;
|
||||
}
|
||||
|
||||
private:
|
||||
KEvent* parent{};
|
||||
};
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "core/hle/kernel/k_auto_object.h"
|
||||
#include "core/hle/kernel/k_slab_heap.h"
|
||||
#include "core/hle/kernel/memory_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
namespace Core {
|
||||
class CPUInterruptHandler;
|
||||
|
@ -293,7 +292,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
friend class Object;
|
||||
friend class Process;
|
||||
friend class KThread;
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
Object::Object(KernelCore& kernel_)
|
||||
: kernel{kernel_}, object_id{kernel_.CreateNewObjectID()}, name{"[UNKNOWN KERNEL OBJECT]"} {}
|
||||
Object::Object(KernelCore& kernel_, std::string&& name_)
|
||||
: kernel{kernel_}, object_id{kernel_.CreateNewObjectID()}, name{std::move(name_)} {}
|
||||
Object::~Object() = default;
|
||||
|
||||
bool Object::IsWaitable() const {
|
||||
switch (GetHandleType()) {
|
||||
case HandleType::ReadableEvent:
|
||||
case HandleType::Thread:
|
||||
case HandleType::Process:
|
||||
case HandleType::ServerPort:
|
||||
case HandleType::ServerSession:
|
||||
return true;
|
||||
|
||||
case HandleType::Unknown:
|
||||
case HandleType::Event:
|
||||
case HandleType::WritableEvent:
|
||||
case HandleType::SharedMemory:
|
||||
case HandleType::TransferMemory:
|
||||
case HandleType::ResourceLimit:
|
||||
case HandleType::ClientPort:
|
||||
case HandleType::ClientSession:
|
||||
case HandleType::Session:
|
||||
return false;
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
|
@ -1,98 +0,0 @@
|
|||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class KernelCore;
|
||||
|
||||
using Handle = u32;
|
||||
|
||||
enum class HandleType : u32 {
|
||||
Unknown,
|
||||
Event,
|
||||
WritableEvent,
|
||||
ReadableEvent,
|
||||
SharedMemory,
|
||||
TransferMemory,
|
||||
Thread,
|
||||
Process,
|
||||
ResourceLimit,
|
||||
ClientPort,
|
||||
ServerPort,
|
||||
ClientSession,
|
||||
ServerSession,
|
||||
Session,
|
||||
};
|
||||
|
||||
class Object : NonCopyable, public std::enable_shared_from_this<Object> {
|
||||
public:
|
||||
explicit Object(KernelCore& kernel_);
|
||||
explicit Object(KernelCore& kernel_, std::string&& name_);
|
||||
virtual ~Object();
|
||||
|
||||
/// Returns a unique identifier for the object. For debugging purposes only.
|
||||
u32 GetObjectId() const {
|
||||
return object_id.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
virtual std::string GetTypeName() const {
|
||||
return "[BAD KERNEL OBJECT TYPE]";
|
||||
}
|
||||
virtual std::string GetName() const {
|
||||
return name;
|
||||
}
|
||||
virtual HandleType GetHandleType() const = 0;
|
||||
|
||||
void Close() {
|
||||
// TODO(bunnei): This is a placeholder to decrement the reference count, which we will use
|
||||
// when we implement KAutoObject instead of using shared_ptr.
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a thread can wait on the object
|
||||
* @return True if a thread can wait on the object, otherwise false
|
||||
*/
|
||||
bool IsWaitable() const;
|
||||
|
||||
virtual void Finalize() = 0;
|
||||
|
||||
protected:
|
||||
/// The kernel instance this object was created under.
|
||||
KernelCore& kernel;
|
||||
|
||||
private:
|
||||
std::atomic<u32> object_id{0};
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<T> SharedFrom(T* raw) {
|
||||
if (raw == nullptr)
|
||||
return nullptr;
|
||||
return std::static_pointer_cast<T>(raw->shared_from_this());
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to downcast the given Object pointer to a pointer to T.
|
||||
* @return Derived pointer to the object, or `nullptr` if `object` isn't of type T.
|
||||
*/
|
||||
template <typename T>
|
||||
inline T* DynamicObjectCast(Object* object) {
|
||||
if (object != nullptr && object->GetHandleType() == T::HANDLE_TYPE) {
|
||||
return reinterpret_cast<T*>(object);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
|
@ -92,18 +92,6 @@ public:
|
|||
static ResultCode Initialize(Process* process, Core::System& system, std::string name,
|
||||
ProcessType type);
|
||||
|
||||
std::string GetTypeName() const override {
|
||||
return "Process";
|
||||
}
|
||||
std::string GetName() const override {
|
||||
return name;
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::Process;
|
||||
HandleType GetHandleType() const override {
|
||||
return HANDLE_TYPE;
|
||||
}
|
||||
|
||||
/// Gets a reference to the process' page table.
|
||||
KPageTable& PageTable() {
|
||||
return *page_table;
|
||||
|
@ -468,9 +456,6 @@ private:
|
|||
/// Process total image size
|
||||
std::size_t image_size{};
|
||||
|
||||
/// Name of this process
|
||||
std::string name;
|
||||
|
||||
/// Schedule count of this process
|
||||
s64 schedule_count{};
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
} // namespace Core
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "common/swap.h"
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
union ResultCode;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "common/quaternion.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/frontend/input.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/service/hid/controllers/controller_base.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "common/swap.h"
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/service/nvdrv/nvdata.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
namespace Common {
|
||||
class Event;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "common/common_types.h"
|
||||
#include "common/spin_lock.h"
|
||||
#include "core/hle/kernel/hle_ipc.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Namespace Service
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Service::SM {
|
|||
|
||||
void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) {
|
||||
ASSERT_MSG(ctx.Session()->IsSession(), "Session is already a domain");
|
||||
LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetObjectId());
|
||||
LOG_DEBUG(Service, "called, server_session={}", ctx.Session()->GetId());
|
||||
ctx.Session()->ConvertToDomain();
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
|
|
|
@ -140,7 +140,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
|
|||
port->EnqueueSession(&session->GetServerSession());
|
||||
}
|
||||
|
||||
LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetObjectId());
|
||||
LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId());
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushMoveObjects(session->GetClientSession());
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/k_class_token.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_synchronization_object.h"
|
||||
|
@ -183,20 +184,20 @@ bool WaitTreeExpandableItem::IsExpandable() const {
|
|||
}
|
||||
|
||||
QString WaitTreeSynchronizationObject::GetText() const {
|
||||
// return tr("[%1]%2 %3")
|
||||
// .arg(object.GetObjectId())
|
||||
// .arg(QString::fromStdString(object.GetTypeName()),
|
||||
// QString::fromStdString(object.GetName()));
|
||||
|
||||
return tr("UNIMPLEMENTED");
|
||||
return tr("[%1] %2 %3")
|
||||
.arg(object.GetId())
|
||||
.arg(QString::fromStdString(object.GetTypeObj().GetName()),
|
||||
QString::fromStdString(object.GetName()));
|
||||
}
|
||||
|
||||
std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make(
|
||||
const Kernel::KSynchronizationObject& object) {
|
||||
switch (object.GetHandleType()) {
|
||||
case Kernel::HandleType::ReadableEvent:
|
||||
const auto type =
|
||||
static_cast<Kernel::KClassTokenGenerator::ObjectType>(object.GetTypeObj().GetClassToken());
|
||||
switch (type) {
|
||||
case Kernel::KClassTokenGenerator::ObjectType::KReadableEvent:
|
||||
return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object));
|
||||
case Kernel::HandleType::Thread:
|
||||
case Kernel::KClassTokenGenerator::ObjectType::KThread:
|
||||
return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object));
|
||||
default:
|
||||
return std::make_unique<WaitTreeSynchronizationObject>(object);
|
||||
|
@ -206,12 +207,13 @@ std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::ma
|
|||
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeSynchronizationObject::GetChildren() const {
|
||||
std::vector<std::unique_ptr<WaitTreeItem>> list;
|
||||
|
||||
const auto& threads = object.GetWaitingThreadsForDebugging();
|
||||
auto threads = object.GetWaitingThreadsForDebugging();
|
||||
if (threads.empty()) {
|
||||
list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread")));
|
||||
} else {
|
||||
list.push_back(std::make_unique<WaitTreeThreadList>(threads));
|
||||
list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads)));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -379,8 +381,8 @@ WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object)
|
|||
: WaitTreeSynchronizationObject(object) {}
|
||||
WaitTreeEvent::~WaitTreeEvent() = default;
|
||||
|
||||
WaitTreeThreadList::WaitTreeThreadList(const std::vector<Kernel::KThread*>& list)
|
||||
: thread_list(list) {}
|
||||
WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list)
|
||||
: thread_list(std::move(list)) {}
|
||||
WaitTreeThreadList::~WaitTreeThreadList() = default;
|
||||
|
||||
QString WaitTreeThreadList::GetText() const {
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
#include <QAbstractItemModel>
|
||||
#include <QDockWidget>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/k_auto_object.h"
|
||||
|
||||
class EmuThread;
|
||||
|
||||
|
@ -149,14 +150,14 @@ public:
|
|||
class WaitTreeThreadList : public WaitTreeExpandableItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WaitTreeThreadList(const std::vector<Kernel::KThread*>& list);
|
||||
explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list);
|
||||
~WaitTreeThreadList() override;
|
||||
|
||||
QString GetText() const override;
|
||||
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
|
||||
|
||||
private:
|
||||
const std::vector<Kernel::KThread*>& thread_list;
|
||||
std::vector<Kernel::KThread*> thread_list;
|
||||
};
|
||||
|
||||
class WaitTreeModel : public QAbstractItemModel {
|
||||
|
|
Loading…
Reference in a new issue