hle: kernel: Remove deprecated Object class.

This commit is contained in:
bunnei 2021-04-23 21:50:04 -07:00
parent 864841eb9e
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.cpp
hle/kernel/kernel.h hle/kernel/kernel.h
hle/kernel/memory_types.h hle/kernel/memory_types.h
hle/kernel/object.cpp
hle/kernel/object.h
hle/kernel/physical_core.cpp hle/kernel/physical_core.cpp
hle/kernel/physical_core.h hle/kernel/physical_core.h
hle/kernel/physical_memory.h hle/kernel/physical_memory.h

View file

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

View file

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

View file

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

View file

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

View file

@ -212,16 +212,6 @@ public:
return move_handles.at(index); 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) { void AddMoveObject(KAutoObject* object) {
move_objects.emplace_back(object); move_objects.emplace_back(object);
} }

View file

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

View file

@ -51,26 +51,11 @@ public:
ResultCode CreateSession(KClientSession** out); 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: private:
std::atomic<s32> num_sessions{}; std::atomic<s32> num_sessions{};
std::atomic<s32> peak_sessions{}; std::atomic<s32> peak_sessions{};
s32 max_sessions{}; s32 max_sessions{};
KPort* parent{}; KPort* parent{};
std::string name;
}; };
} // namespace Kernel } // namespace Kernel

View file

@ -54,27 +54,8 @@ public:
void OnServerClosed(); 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: private:
/// The parent session, which links to the server endpoint.
KSession* parent{}; KSession* parent{};
/// Name of the client session (optional)
std::string name;
}; };
} // namespace Kernel } // namespace Kernel

View file

@ -48,17 +48,6 @@ public:
return writable_event; 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: private:
KReadableEvent readable_event; KReadableEvent readable_event;
KWritableEvent writable_event; KWritableEvent writable_event;

View file

@ -51,22 +51,6 @@ public:
return server; 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: private:
enum class State : u8 { enum class State : u8 {
Invalid = 0, Invalid = 0,
@ -80,8 +64,6 @@ private:
KClientPort client; KClientPort client;
State state{State::Invalid}; State state{State::Invalid};
bool is_light{}; bool is_light{};
std::string name; ///< Name of client port (optional)
}; };
} // namespace Kernel } // namespace Kernel

View file

@ -6,7 +6,6 @@
#include "core/hle/kernel/k_auto_object.h" #include "core/hle/kernel/k_auto_object.h"
#include "core/hle/kernel/k_synchronization_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/kernel/slab_helpers.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -39,17 +38,6 @@ public:
ResultCode Clear(); ResultCode Clear();
ResultCode Reset(); 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: private:
bool is_signaled{}; bool is_signaled{};
KEvent* parent{}; KEvent* parent{};

View file

@ -8,7 +8,6 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/k_light_condition_variable.h" #include "core/hle/kernel/k_light_condition_variable.h"
#include "core/hle/kernel/k_light_lock.h" #include "core/hle/kernel/k_light_lock.h"
#include "core/hle/kernel/object.h"
union ResultCode; union ResultCode;
@ -57,20 +56,6 @@ public:
static void PostDestroy([[maybe_unused]] uintptr_t arg) {} 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: private:
using ResourceArray = std::array<s64, static_cast<std::size_t>(LimitableResource::Count)>; using ResourceArray = std::array<s64, static_cast<std::size_t>(LimitableResource::Count)>;
ResourceArray limit_values{}; ResourceArray limit_values{};

View file

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

View file

@ -68,20 +68,6 @@ public:
virtual void Destroy() override; virtual void Destroy() override;
virtual bool IsSignaled() const 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: private:
void CleanupSessions(); void CleanupSessions();
@ -89,7 +75,6 @@ private:
SessionList session_list; SessionList session_list;
HLEHandler hle_handler; HLEHandler hle_handler;
KPort* parent{}; KPort* parent{};
std::string name;
}; };
} // namespace Kernel } // namespace Kernel

View file

@ -103,21 +103,6 @@ public:
convert_to_domain = true; 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: private:
/// Queues a sync request from the emulated application. /// Queues a sync request from the emulated application.
ResultCode QueueSyncRequest(KThread* thread, Core::Memory::Memory& memory); 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 /// When set to True, converts the session to a domain at the end of the command
bool convert_to_domain{}; bool convert_to_domain{};
/// The name of this session (optional)
std::string name;
/// Thread to dispatch service requests /// Thread to dispatch service requests
std::weak_ptr<ServiceThread> service_thread; std::weak_ptr<ServiceThread> service_thread;

View file

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

View file

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

View file

@ -32,19 +32,6 @@ public:
KMemoryPermission owner_permission_, KMemoryPermission user_permission_, KMemoryPermission owner_permission_, KMemoryPermission user_permission_,
PAddr physical_address_, std::size_t size_, std::string name_); 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 * 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 * @param target_process Process on which to map the memory block

View file

@ -51,13 +51,4 @@ private:
ThreadListNode* thread_list_tail{}; 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 } // namespace Kernel

View file

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

View file

@ -19,7 +19,6 @@
#include "core/hle/kernel/k_light_lock.h" #include "core/hle/kernel/k_light_lock.h"
#include "core/hle/kernel/k_spin_lock.h" #include "core/hle/kernel/k_spin_lock.h"
#include "core/hle/kernel/k_synchronization_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/kernel/slab_helpers.h"
#include "core/hle/kernel/svc_common.h" #include "core/hle/kernel/svc_common.h"
#include "core/hle/kernel/svc_types.h" #include "core/hle/kernel/svc_types.h"
@ -120,23 +119,10 @@ public:
using ThreadContext64 = Core::ARM_Interface::ThreadContext64; using ThreadContext64 = Core::ARM_Interface::ThreadContext64;
using WaiterList = boost::intrusive::list<KThread>; using WaiterList = boost::intrusive::list<KThread>;
[[nodiscard]] std::string GetName() const override {
return name;
}
void SetName(std::string new_name) { void SetName(std::string new_name) {
name = std::move(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 * Gets the thread's current priority
* @return The current thread's priority * @return The current thread's priority
@ -728,7 +714,6 @@ private:
VAddr mutex_wait_address_for_debugging{}; VAddr mutex_wait_address_for_debugging{};
ThreadWaitReasonForDebugging wait_reason_for_debugging{}; ThreadWaitReasonForDebugging wait_reason_for_debugging{};
ThreadType thread_type_for_debugging{}; ThreadType thread_type_for_debugging{};
std::string name;
public: public:
using ConditionVariableThreadTreeType = ConditionVariableThreadTree; using ConditionVariableThreadTreeType = ConditionVariableThreadTree;

View file

@ -55,21 +55,6 @@ public:
return is_initialized ? size * PageSize : 0; 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: private:
Process* owner{}; Process* owner{};
VAddr address{}; VAddr address{};

View file

@ -5,7 +5,6 @@
#pragma once #pragma once
#include "core/hle/kernel/k_auto_object.h" #include "core/hle/kernel/k_auto_object.h"
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/slab_helpers.h" #include "core/hle/kernel/slab_helpers.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -34,17 +33,6 @@ public:
return parent; 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: private:
KEvent* parent{}; KEvent* parent{};
}; };

View file

@ -14,7 +14,6 @@
#include "core/hle/kernel/k_auto_object.h" #include "core/hle/kernel/k_auto_object.h"
#include "core/hle/kernel/k_slab_heap.h" #include "core/hle/kernel/k_slab_heap.h"
#include "core/hle/kernel/memory_types.h" #include "core/hle/kernel/memory_types.h"
#include "core/hle/kernel/object.h"
namespace Core { namespace Core {
class CPUInterruptHandler; class CPUInterruptHandler;
@ -293,7 +292,6 @@ public:
} }
private: private:
friend class Object;
friend class Process; friend class Process;
friend class KThread; friend class KThread;

View file

@ -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

View file

@ -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

View file

@ -92,18 +92,6 @@ public:
static ResultCode Initialize(Process* process, Core::System& system, std::string name, static ResultCode Initialize(Process* process, Core::System& system, std::string name,
ProcessType type); 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. /// Gets a reference to the process' page table.
KPageTable& PageTable() { KPageTable& PageTable() {
return *page_table; return *page_table;
@ -468,9 +456,6 @@ private:
/// Process total image size /// Process total image size
std::size_t image_size{}; std::size_t image_size{};
/// Name of this process
std::string name;
/// Schedule count of this process /// Schedule count of this process
s64 schedule_count{}; s64 schedule_count{};

View file

@ -8,8 +8,6 @@
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>
#include "core/hle/kernel/object.h"
namespace Core { namespace Core {
class System; class System;
} // namespace Core } // namespace Core

View file

@ -9,7 +9,6 @@
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/object.h"
union ResultCode; union ResultCode;

View file

@ -11,7 +11,6 @@
#include "common/quaternion.h" #include "common/quaternion.h"
#include "common/settings.h" #include "common/settings.h"
#include "core/frontend/input.h" #include "core/frontend/input.h"
#include "core/hle/kernel/object.h"
#include "core/hle/service/hid/controllers/controller_base.h" #include "core/hle/service/hid/controllers/controller_base.h"
namespace Kernel { namespace Kernel {

View file

@ -4,7 +4,6 @@
#pragma once #pragma once
#include "core/hle/kernel/object.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core { namespace Core {

View file

@ -15,7 +15,6 @@
#include "common/swap.h" #include "common/swap.h"
#include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_event.h"
#include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/k_readable_event.h"
#include "core/hle/kernel/object.h"
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
namespace Kernel { namespace Kernel {

View file

@ -15,7 +15,6 @@
#include <vector> #include <vector>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h"
namespace Common { namespace Common {
class Event; class Event;

View file

@ -11,7 +11,6 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/spin_lock.h" #include "common/spin_lock.h"
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/object.h"
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace Service // Namespace Service

View file

@ -14,7 +14,7 @@ namespace Service::SM {
void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) { void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) {
ASSERT_MSG(ctx.Session()->IsSession(), "Session is already a domain"); 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(); ctx.Session()->ConvertToDomain();
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};

View file

@ -140,7 +140,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
port->EnqueueSession(&session->GetServerSession()); 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}; IPC::ResponseBuilder rb{ctx, 2, 0, 1, IPC::ResponseBuilder::Flags::AlwaysMoveHandles};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushMoveObjects(session->GetClientSession()); rb.PushMoveObjects(session->GetClientSession());

View file

@ -13,6 +13,7 @@
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/kernel/handle_table.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_readable_event.h"
#include "core/hle/kernel/k_scheduler.h" #include "core/hle/kernel/k_scheduler.h"
#include "core/hle/kernel/k_synchronization_object.h" #include "core/hle/kernel/k_synchronization_object.h"
@ -183,20 +184,20 @@ bool WaitTreeExpandableItem::IsExpandable() const {
} }
QString WaitTreeSynchronizationObject::GetText() const { QString WaitTreeSynchronizationObject::GetText() const {
// return tr("[%1]%2 %3") return tr("[%1] %2 %3")
// .arg(object.GetObjectId()) .arg(object.GetId())
// .arg(QString::fromStdString(object.GetTypeName()), .arg(QString::fromStdString(object.GetTypeObj().GetName()),
// QString::fromStdString(object.GetName())); QString::fromStdString(object.GetName()));
return tr("UNIMPLEMENTED");
} }
std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make( std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make(
const Kernel::KSynchronizationObject& object) { const Kernel::KSynchronizationObject& object) {
switch (object.GetHandleType()) { const auto type =
case Kernel::HandleType::ReadableEvent: 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)); 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)); return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object));
default: default:
return std::make_unique<WaitTreeSynchronizationObject>(object); 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>> WaitTreeSynchronizationObject::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list; std::vector<std::unique_ptr<WaitTreeItem>> list;
const auto& threads = object.GetWaitingThreadsForDebugging(); auto threads = object.GetWaitingThreadsForDebugging();
if (threads.empty()) { if (threads.empty()) {
list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread"))); list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread")));
} else { } else {
list.push_back(std::make_unique<WaitTreeThreadList>(threads)); list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads)));
} }
return list; return list;
} }
@ -379,8 +381,8 @@ WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object)
: WaitTreeSynchronizationObject(object) {} : WaitTreeSynchronizationObject(object) {}
WaitTreeEvent::~WaitTreeEvent() = default; WaitTreeEvent::~WaitTreeEvent() = default;
WaitTreeThreadList::WaitTreeThreadList(const std::vector<Kernel::KThread*>& list) WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list)
: thread_list(list) {} : thread_list(std::move(list)) {}
WaitTreeThreadList::~WaitTreeThreadList() = default; WaitTreeThreadList::~WaitTreeThreadList() = default;
QString WaitTreeThreadList::GetText() const { QString WaitTreeThreadList::GetText() const {

View file

@ -11,8 +11,9 @@
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QDockWidget> #include <QDockWidget>
#include <QTreeView> #include <QTreeView>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/k_auto_object.h"
class EmuThread; class EmuThread;
@ -149,14 +150,14 @@ public:
class WaitTreeThreadList : public WaitTreeExpandableItem { class WaitTreeThreadList : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeThreadList(const std::vector<Kernel::KThread*>& list); explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list);
~WaitTreeThreadList() override; ~WaitTreeThreadList() override;
QString GetText() const override; QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
private: private:
const std::vector<Kernel::KThread*>& thread_list; std::vector<Kernel::KThread*> thread_list;
}; };
class WaitTreeModel : public QAbstractItemModel { class WaitTreeModel : public QAbstractItemModel {