3
0
Fork 0
forked from suyu/suyu

Kernel: Replace GetStaticHandleType by HANDLE_TYPE constants

This commit is contained in:
Yuri Kunde Schlesner 2014-12-21 08:40:29 -02:00
parent 73fba22c01
commit 23f2142009
8 changed files with 15 additions and 15 deletions

View file

@ -20,8 +20,8 @@ public:
std::string GetTypeName() const override { return "Arbiter"; } std::string GetTypeName() const override { return "Arbiter"; }
std::string GetName() const override { return name; } std::string GetName() const override { return name; }
static Kernel::HandleType GetStaticHandleType() { return HandleType::AddressArbiter; } static const HandleType HANDLE_TYPE = HandleType::AddressArbiter;
Kernel::HandleType GetHandleType() const override { return HandleType::AddressArbiter; } HandleType GetHandleType() const override { return HANDLE_TYPE; }
std::string name; ///< Name of address arbiter object (optional) std::string name; ///< Name of address arbiter object (optional)
}; };

View file

@ -19,8 +19,8 @@ public:
std::string GetTypeName() const override { return "Event"; } std::string GetTypeName() const override { return "Event"; }
std::string GetName() const override { return name; } std::string GetName() const override { return name; }
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Event; } static const HandleType HANDLE_TYPE = HandleType::Event;
Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Event; } HandleType GetHandleType() const override { return HANDLE_TYPE; }
ResetType intitial_reset_type; ///< ResetType specified at Event initialization ResetType intitial_reset_type; ///< ResetType specified at Event initialization
ResetType reset_type; ///< Current ResetType ResetType reset_type; ///< Current ResetType

View file

@ -96,7 +96,7 @@ public:
return nullptr; return nullptr;
} else { } else {
Object* t = pool[handle - HANDLE_OFFSET]; Object* t = pool[handle - HANDLE_OFFSET];
if (t->GetHandleType() != T::GetStaticHandleType()) { if (t->GetHandleType() != T::HANDLE_TYPE) {
LOG_ERROR(Kernel, "Wrong object type for %08x", handle); LOG_ERROR(Kernel, "Wrong object type for %08x", handle);
return nullptr; return nullptr;
} }

View file

@ -18,8 +18,8 @@ public:
std::string GetTypeName() const override { return "Mutex"; } std::string GetTypeName() const override { return "Mutex"; }
std::string GetName() const override { return name; } std::string GetName() const override { return name; }
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Mutex; } static const HandleType HANDLE_TYPE = HandleType::Mutex;
Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Mutex; } HandleType GetHandleType() const override { return HANDLE_TYPE; }
bool initial_locked; ///< Initial lock state when mutex was created bool initial_locked; ///< Initial lock state when mutex was created
bool locked; ///< Current locked state bool locked; ///< Current locked state

View file

@ -17,8 +17,8 @@ public:
std::string GetTypeName() const override { return "Semaphore"; } std::string GetTypeName() const override { return "Semaphore"; }
std::string GetName() const override { return name; } std::string GetName() const override { return name; }
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Semaphore; } static const HandleType HANDLE_TYPE = HandleType::Semaphore;
Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Semaphore; } HandleType GetHandleType() const override { return HANDLE_TYPE; }
s32 max_count; ///< Maximum number of simultaneous holders the semaphore can have s32 max_count; ///< Maximum number of simultaneous holders the semaphore can have
s32 available_count; ///< Number of free slots left in the semaphore s32 available_count; ///< Number of free slots left in the semaphore

View file

@ -45,8 +45,8 @@ class Session : public Object {
public: public:
std::string GetTypeName() const override { return "Session"; } std::string GetTypeName() const override { return "Session"; }
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Session; } static const HandleType HANDLE_TYPE = HandleType::Session;
Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Session; } HandleType GetHandleType() const override { return HANDLE_TYPE; }
/** /**
* Handles a synchronous call to this session using HLE emulation. Emulated <-> emulated calls * Handles a synchronous call to this session using HLE emulation. Emulated <-> emulated calls

View file

@ -13,8 +13,8 @@ class SharedMemory : public Object {
public: public:
std::string GetTypeName() const override { return "SharedMemory"; } std::string GetTypeName() const override { return "SharedMemory"; }
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::SharedMemory; } static const HandleType HANDLE_TYPE = HandleType::SharedMemory;
Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::SharedMemory; } HandleType GetHandleType() const override { return HANDLE_TYPE; }
u32 base_address; ///< Address of shared memory block in RAM u32 base_address; ///< Address of shared memory block in RAM
MemoryPermission permissions; ///< Permissions of shared memory block (SVC field) MemoryPermission permissions; ///< Permissions of shared memory block (SVC field)

View file

@ -26,8 +26,8 @@ public:
std::string GetName() const override { return name; } std::string GetName() const override { return name; }
std::string GetTypeName() const override { return "Thread"; } std::string GetTypeName() const override { return "Thread"; }
static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } static const HandleType HANDLE_TYPE = HandleType::Thread;
Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Thread; } HandleType GetHandleType() const override { return HANDLE_TYPE; }
inline bool IsRunning() const { return (status & THREADSTATUS_RUNNING) != 0; } inline bool IsRunning() const { return (status & THREADSTATUS_RUNNING) != 0; }
inline bool IsStopped() const { return (status & THREADSTATUS_DORMANT) != 0; } inline bool IsStopped() const { return (status & THREADSTATUS_DORMANT) != 0; }