diff options
| author | 2014-05-20 18:13:25 -0400 | |
|---|---|---|
| committer | 2014-05-20 18:13:25 -0400 | |
| commit | 44336329eddd7dbe1f76144e9a1e95e5f76ed372 (patch) | |
| tree | 49c103d52af50fe6ef451324f1c8aae6363d0468 /src | |
| parent | apt: changed stubbed handle to be something other than 0xDEADBEEF (used as a ... (diff) | |
| download | yuzu-44336329eddd7dbe1f76144e9a1e95e5f76ed372.tar.gz yuzu-44336329eddd7dbe1f76144e9a1e95e5f76ed372.tar.xz yuzu-44336329eddd7dbe1f76144e9a1e95e5f76ed372.zip | |
- created a Kernel namespace
- cleaned up Kernel code a bit (moved stuff into namespace, fixed whitespace issues)
- added handle types for all different CTROS handles
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 49 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 75 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 18 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 12 |
6 files changed, 87 insertions, 75 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index f7145ddd8..b1fdffde5 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -12,22 +12,16 @@ | |||
| 12 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/kernel.h" |
| 13 | #include "core/hle/kernel/thread.h" | 13 | #include "core/hle/kernel/thread.h" |
| 14 | 14 | ||
| 15 | KernelObjectPool g_kernel_objects; | 15 | namespace Kernel { |
| 16 | 16 | ||
| 17 | void __KernelInit() { | 17 | ObjectPool g_object_pool; |
| 18 | __KernelThreadingInit(); | ||
| 19 | } | ||
| 20 | |||
| 21 | void __KernelShutdown() { | ||
| 22 | __KernelThreadingShutdown(); | ||
| 23 | } | ||
| 24 | 18 | ||
| 25 | KernelObjectPool::KernelObjectPool() { | 19 | ObjectPool::ObjectPool() { |
| 26 | memset(occupied, 0, sizeof(bool) * MAX_COUNT); | 20 | memset(occupied, 0, sizeof(bool) * MAX_COUNT); |
| 27 | next_id = INITIAL_NEXT_ID; | 21 | next_id = INITIAL_NEXT_ID; |
| 28 | } | 22 | } |
| 29 | 23 | ||
| 30 | Handle KernelObjectPool::Create(KernelObject *obj, int range_bottom, int range_top) { | 24 | Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) { |
| 31 | if (range_top > MAX_COUNT) { | 25 | if (range_top > MAX_COUNT) { |
| 32 | range_top = MAX_COUNT; | 26 | range_top = MAX_COUNT; |
| 33 | } | 27 | } |
| @@ -46,8 +40,7 @@ Handle KernelObjectPool::Create(KernelObject *obj, int range_bottom, int range_t | |||
| 46 | return 0; | 40 | return 0; |
| 47 | } | 41 | } |
| 48 | 42 | ||
| 49 | bool KernelObjectPool::IsValid(Handle handle) | 43 | bool ObjectPool::IsValid(Handle handle) { |
| 50 | { | ||
| 51 | int index = handle - HANDLE_OFFSET; | 44 | int index = handle - HANDLE_OFFSET; |
| 52 | if (index < 0) | 45 | if (index < 0) |
| 53 | return false; | 46 | return false; |
| @@ -57,26 +50,24 @@ bool KernelObjectPool::IsValid(Handle handle) | |||
| 57 | return occupied[index]; | 50 | return occupied[index]; |
| 58 | } | 51 | } |
| 59 | 52 | ||
| 60 | void KernelObjectPool::Clear() | 53 | void ObjectPool::Clear() { |
| 61 | { | 54 | for (int i = 0; i < MAX_COUNT; i++) { |
| 62 | for (int i = 0; i < MAX_COUNT; i++) | ||
| 63 | { | ||
| 64 | //brutally clear everything, no validation | 55 | //brutally clear everything, no validation |
| 65 | if (occupied[i]) | 56 | if (occupied[i]) |
| 66 | delete pool[i]; | 57 | delete pool[i]; |
| 67 | occupied[i] = false; | 58 | occupied[i] = false; |
| 68 | } | 59 | } |
| 69 | memset(pool, 0, sizeof(KernelObject*)*MAX_COUNT); | 60 | memset(pool, 0, sizeof(Object*)*MAX_COUNT); |
| 70 | next_id = INITIAL_NEXT_ID; | 61 | next_id = INITIAL_NEXT_ID; |
| 71 | } | 62 | } |
| 72 | 63 | ||
| 73 | KernelObject *&KernelObjectPool::operator [](Handle handle) | 64 | Object* &ObjectPool::operator [](Handle handle) |
| 74 | { | 65 | { |
| 75 | _dbg_assert_msg_(KERNEL, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); | 66 | _dbg_assert_msg_(KERNEL, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); |
| 76 | return pool[handle - HANDLE_OFFSET]; | 67 | return pool[handle - HANDLE_OFFSET]; |
| 77 | } | 68 | } |
| 78 | 69 | ||
| 79 | void KernelObjectPool::List() { | 70 | void ObjectPool::List() { |
| 80 | for (int i = 0; i < MAX_COUNT; i++) { | 71 | for (int i = 0; i < MAX_COUNT; i++) { |
| 81 | if (occupied[i]) { | 72 | if (occupied[i]) { |
| 82 | if (pool[i]) { | 73 | if (pool[i]) { |
| @@ -87,18 +78,16 @@ void KernelObjectPool::List() { | |||
| 87 | } | 78 | } |
| 88 | } | 79 | } |
| 89 | 80 | ||
| 90 | int KernelObjectPool::GetCount() | 81 | int ObjectPool::GetCount() { |
| 91 | { | ||
| 92 | int count = 0; | 82 | int count = 0; |
| 93 | for (int i = 0; i < MAX_COUNT; i++) | 83 | for (int i = 0; i < MAX_COUNT; i++) { |
| 94 | { | ||
| 95 | if (occupied[i]) | 84 | if (occupied[i]) |
| 96 | count++; | 85 | count++; |
| 97 | } | 86 | } |
| 98 | return count; | 87 | return count; |
| 99 | } | 88 | } |
| 100 | 89 | ||
| 101 | KernelObject *KernelObjectPool::CreateByIDType(int type) { | 90 | Object* ObjectPool::CreateByIDType(int type) { |
| 102 | // Used for save states. This is ugly, but what other way is there? | 91 | // Used for save states. This is ugly, but what other way is there? |
| 103 | switch (type) { | 92 | switch (type) { |
| 104 | //case SCE_KERNEL_TMID_Alarm: | 93 | //case SCE_KERNEL_TMID_Alarm: |
| @@ -142,8 +131,18 @@ KernelObject *KernelObjectPool::CreateByIDType(int type) { | |||
| 142 | } | 131 | } |
| 143 | } | 132 | } |
| 144 | 133 | ||
| 134 | void Init() { | ||
| 135 | __KernelThreadingInit(); | ||
| 136 | } | ||
| 137 | |||
| 138 | void Shutdown() { | ||
| 139 | __KernelThreadingShutdown(); | ||
| 140 | } | ||
| 141 | |||
| 142 | } // namespace | ||
| 143 | |||
| 145 | bool __KernelLoadExec(u32 entry_point) { | 144 | bool __KernelLoadExec(u32 entry_point) { |
| 146 | __KernelInit(); | 145 | Kernel::Init(); |
| 147 | 146 | ||
| 148 | Core::g_app_core->SetPC(entry_point); | 147 | Core::g_app_core->SetPC(entry_point); |
| 149 | 148 | ||
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 8f2b7b36d..19edb7b57 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -9,41 +9,50 @@ | |||
| 9 | typedef u32 Handle; | 9 | typedef u32 Handle; |
| 10 | typedef s32 Result; | 10 | typedef s32 Result; |
| 11 | 11 | ||
| 12 | enum KernelIDType { | 12 | namespace Kernel { |
| 13 | KERNEL_ID_TYPE_THREAD, | 13 | |
| 14 | KERNEL_ID_TYPE_SEMAPHORE, | 14 | enum class HandleType : u32 { |
| 15 | KERNEL_ID_TYPE_MUTEX, | 15 | Unknown = 0, |
| 16 | KERNEL_ID_TYPE_EVENT, | 16 | Port = 1, |
| 17 | KERNEL_ID_TYPE_SERVICE, | 17 | Service = 2, |
| 18 | Event = 3, | ||
| 19 | Mutex = 4, | ||
| 20 | SharedMemory = 5, | ||
| 21 | Redirection = 6, | ||
| 22 | Thread = 7, | ||
| 23 | Process = 8, | ||
| 24 | Arbiter = 9, | ||
| 25 | File = 10, | ||
| 26 | Semaphore = 11, | ||
| 18 | }; | 27 | }; |
| 19 | 28 | ||
| 20 | enum { | 29 | enum { |
| 21 | KERNEL_MAX_NAME_LENGTH = 0x100, | 30 | MAX_NAME_LENGTH = 0x100, |
| 22 | KERNEL_DEFAULT_STACK_SIZE = 0x4000, | 31 | DEFAULT_STACK_SIZE = 0x4000, |
| 23 | }; | 32 | }; |
| 24 | 33 | ||
| 25 | class KernelObjectPool; | 34 | class ObjectPool; |
| 26 | 35 | ||
| 27 | class KernelObject { | 36 | class Object : NonCopyable { |
| 28 | friend class KernelObjectPool; | 37 | friend class ObjectPool; |
| 29 | u32 handle; | 38 | u32 handle; |
| 30 | public: | 39 | public: |
| 31 | virtual ~KernelObject() {} | 40 | virtual ~Object() {} |
| 32 | Handle GetHandle() const { return handle; } | 41 | Handle GetHandle() const { return handle; } |
| 33 | virtual const char *GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; } | 42 | virtual const char *GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; } |
| 34 | virtual const char *GetName() { return "[UNKNOWN KERNEL OBJECT]"; } | 43 | virtual const char *GetName() { return "[UNKNOWN KERNEL OBJECT]"; } |
| 35 | virtual KernelIDType GetIDType() const = 0; | 44 | virtual Kernel::HandleType GetHandleType() const = 0; |
| 36 | }; | 45 | }; |
| 37 | 46 | ||
| 38 | class KernelObjectPool { | 47 | class ObjectPool : NonCopyable { |
| 39 | public: | 48 | public: |
| 40 | KernelObjectPool(); | 49 | ObjectPool(); |
| 41 | ~KernelObjectPool() {} | 50 | ~ObjectPool() {} |
| 42 | 51 | ||
| 43 | // Allocates a handle within the range and inserts the object into the map. | 52 | // Allocates a handle within the range and inserts the object into the map. |
| 44 | Handle Create(KernelObject *obj, int range_bottom=INITIAL_NEXT_ID, int range_top=0x7FFFFFFF); | 53 | Handle Create(Object* obj, int range_bottom=INITIAL_NEXT_ID, int range_top=0x7FFFFFFF); |
| 45 | 54 | ||
| 46 | static KernelObject *CreateByIDType(int type); | 55 | static Object* CreateByIDType(int type); |
| 47 | 56 | ||
| 48 | template <class T> | 57 | template <class T> |
| 49 | u32 Destroy(Handle handle) { | 58 | u32 Destroy(Handle handle) { |
| @@ -71,7 +80,7 @@ public: | |||
| 71 | // it just acted as a static case and everything worked. This means that we will never | 80 | // it just acted as a static case and everything worked. This means that we will never |
| 72 | // see the Wrong type object error below, but we'll just have to live with that danger. | 81 | // see the Wrong type object error below, but we'll just have to live with that danger. |
| 73 | T* t = static_cast<T*>(pool[handle - HANDLE_OFFSET]); | 82 | T* t = static_cast<T*>(pool[handle - HANDLE_OFFSET]); |
| 74 | if (t == 0 || t->GetIDType() != T::GetStaticIDType()) { | 83 | if (t == 0 || t->GetHandleType() != T::GetStaticHandleType()) { |
| 75 | WARN_LOG(KERNEL, "Kernel: Wrong object type for %i (%08x)", handle, handle); | 84 | WARN_LOG(KERNEL, "Kernel: Wrong object type for %i (%08x)", handle, handle); |
| 76 | outError = 0;//T::GetMissingErrorCode(); | 85 | outError = 0;//T::GetMissingErrorCode(); |
| 77 | return 0; | 86 | return 0; |
| @@ -86,17 +95,17 @@ public: | |||
| 86 | T *GetFast(Handle handle) { | 95 | T *GetFast(Handle handle) { |
| 87 | const Handle realHandle = handle - HANDLE_OFFSET; | 96 | const Handle realHandle = handle - HANDLE_OFFSET; |
| 88 | _dbg_assert_(KERNEL, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]); | 97 | _dbg_assert_(KERNEL, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]); |
| 89 | return static_cast<T *>(pool[realHandle]); | 98 | return static_cast<T*>(pool[realHandle]); |
| 90 | } | 99 | } |
| 91 | 100 | ||
| 92 | template <class T, typename ArgT> | 101 | template <class T, typename ArgT> |
| 93 | void Iterate(bool func(T *, ArgT), ArgT arg) { | 102 | void Iterate(bool func(T*, ArgT), ArgT arg) { |
| 94 | int type = T::GetStaticIDType(); | 103 | int type = T::GetStaticIDType(); |
| 95 | for (int i = 0; i < MAX_COUNT; i++) | 104 | for (int i = 0; i < MAX_COUNT; i++) |
| 96 | { | 105 | { |
| 97 | if (!occupied[i]) | 106 | if (!occupied[i]) |
| 98 | continue; | 107 | continue; |
| 99 | T *t = static_cast<T *>(pool[i]); | 108 | T* t = static_cast<T*>(pool[i]); |
| 100 | if (t->GetIDType() == type) { | 109 | if (t->GetIDType() == type) { |
| 101 | if (!func(t, arg)) | 110 | if (!func(t, arg)) |
| 102 | break; | 111 | break; |
| @@ -104,33 +113,37 @@ public: | |||
| 104 | } | 113 | } |
| 105 | } | 114 | } |
| 106 | 115 | ||
| 107 | bool GetIDType(Handle handle, int *type) const { | 116 | bool GetIDType(Handle handle, HandleType* type) const { |
| 108 | if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || | 117 | if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || |
| 109 | !occupied[handle - HANDLE_OFFSET]) { | 118 | !occupied[handle - HANDLE_OFFSET]) { |
| 110 | ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); | 119 | ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); |
| 111 | return false; | 120 | return false; |
| 112 | } | 121 | } |
| 113 | KernelObject *t = pool[handle - HANDLE_OFFSET]; | 122 | Object* t = pool[handle - HANDLE_OFFSET]; |
| 114 | *type = t->GetIDType(); | 123 | *type = t->GetHandleType(); |
| 115 | return true; | 124 | return true; |
| 116 | } | 125 | } |
| 117 | 126 | ||
| 118 | KernelObject *&operator [](Handle handle); | 127 | Object* &operator [](Handle handle); |
| 119 | void List(); | 128 | void List(); |
| 120 | void Clear(); | 129 | void Clear(); |
| 121 | int GetCount(); | 130 | int GetCount(); |
| 122 | 131 | ||
| 123 | private: | 132 | private: |
| 133 | |||
| 124 | enum { | 134 | enum { |
| 125 | MAX_COUNT = 0x1000, | 135 | MAX_COUNT = 0x1000, |
| 126 | HANDLE_OFFSET = 0x100, | 136 | HANDLE_OFFSET = 0x100, |
| 127 | INITIAL_NEXT_ID = 0x10, | 137 | INITIAL_NEXT_ID = 0x10, |
| 128 | }; | 138 | }; |
| 129 | KernelObject *pool[MAX_COUNT]; | 139 | |
| 130 | bool occupied[MAX_COUNT]; | 140 | Object* pool[MAX_COUNT]; |
| 131 | int next_id; | 141 | bool occupied[MAX_COUNT]; |
| 142 | int next_id; | ||
| 132 | }; | 143 | }; |
| 133 | 144 | ||
| 134 | extern KernelObjectPool g_kernel_objects; | 145 | extern ObjectPool g_object_pool; |
| 146 | |||
| 147 | } // namespace | ||
| 135 | 148 | ||
| 136 | bool __KernelLoadExec(u32 entry_point); | 149 | bool __KernelLoadExec(u32 entry_point); |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 634218e8b..2955d6f5b 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -42,14 +42,14 @@ enum WaitType { | |||
| 42 | WAITTYPE_SYNCH, | 42 | WAITTYPE_SYNCH, |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | class Thread : public KernelObject { | 45 | class Thread : public Kernel::Object { |
| 46 | public: | 46 | public: |
| 47 | 47 | ||
| 48 | const char *GetName() { return name; } | 48 | const char *GetName() { return name; } |
| 49 | const char *GetTypeName() { return "Thread"; } | 49 | const char *GetTypeName() { return "Thread"; } |
| 50 | 50 | ||
| 51 | static KernelIDType GetStaticIDType() { return KERNEL_ID_TYPE_THREAD; } | 51 | static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } |
| 52 | KernelIDType GetIDType() const { return KERNEL_ID_TYPE_THREAD; } | 52 | Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; } |
| 53 | 53 | ||
| 54 | inline bool IsRunning() const { return (status & THREADSTATUS_RUNNING) != 0; } | 54 | inline bool IsRunning() const { return (status & THREADSTATUS_RUNNING) != 0; } |
| 55 | inline bool IsStopped() const { return (status & THREADSTATUS_DORMANT) != 0; } | 55 | inline bool IsStopped() const { return (status & THREADSTATUS_DORMANT) != 0; } |
| @@ -71,7 +71,7 @@ public: | |||
| 71 | 71 | ||
| 72 | WaitType wait_type; | 72 | WaitType wait_type; |
| 73 | 73 | ||
| 74 | char name[KERNEL_MAX_NAME_LENGTH+1]; | 74 | char name[Kernel::MAX_NAME_LENGTH + 1]; |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | // Lists all thread ids that aren't deleted/etc. | 77 | // Lists all thread ids that aren't deleted/etc. |
| @@ -201,7 +201,7 @@ Thread *__KernelCreateThread(Handle &handle, const char *name, u32 entry_point, | |||
| 201 | 201 | ||
| 202 | Thread *t = new Thread; | 202 | Thread *t = new Thread; |
| 203 | 203 | ||
| 204 | handle = g_kernel_objects.Create(t); | 204 | handle = Kernel::g_object_pool.Create(t); |
| 205 | 205 | ||
| 206 | g_thread_queue.push_back(handle); | 206 | g_thread_queue.push_back(handle); |
| 207 | g_thread_ready_queue.prepare(priority); | 207 | g_thread_ready_queue.prepare(priority); |
| @@ -214,8 +214,8 @@ Thread *__KernelCreateThread(Handle &handle, const char *name, u32 entry_point, | |||
| 214 | t->processor_id = processor_id; | 214 | t->processor_id = processor_id; |
| 215 | t->wait_type = WAITTYPE_NONE; | 215 | t->wait_type = WAITTYPE_NONE; |
| 216 | 216 | ||
| 217 | strncpy(t->name, name, KERNEL_MAX_NAME_LENGTH); | 217 | strncpy(t->name, name, Kernel::MAX_NAME_LENGTH); |
| 218 | t->name[KERNEL_MAX_NAME_LENGTH] = '\0'; | 218 | t->name[Kernel::MAX_NAME_LENGTH] = '\0'; |
| 219 | 219 | ||
| 220 | return t; | 220 | return t; |
| 221 | } | 221 | } |
| @@ -296,7 +296,7 @@ Thread *__KernelNextThread() { | |||
| 296 | if (next < 0) { | 296 | if (next < 0) { |
| 297 | return NULL; | 297 | return NULL; |
| 298 | } | 298 | } |
| 299 | return g_kernel_objects.GetFast<Thread>(next); | 299 | return Kernel::g_object_pool.GetFast<Thread>(next); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | /// Sets up the primary application thread | 302 | /// Sets up the primary application thread |
| @@ -326,7 +326,7 @@ Handle __KernelSetupMainThread(s32 priority, int stack_size) { | |||
| 326 | /// Resumes a thread from waiting by marking it as "ready" | 326 | /// Resumes a thread from waiting by marking it as "ready" |
| 327 | void __KernelResumeThreadFromWait(Handle handle) { | 327 | void __KernelResumeThreadFromWait(Handle handle) { |
| 328 | u32 error; | 328 | u32 error; |
| 329 | Thread *t = g_kernel_objects.Get<Thread>(handle, error); | 329 | Thread *t = Kernel::g_object_pool.Get<Thread>(handle, error); |
| 330 | if (t) { | 330 | if (t) { |
| 331 | t->status &= ~THREADSTATUS_WAIT; | 331 | t->status &= ~THREADSTATUS_WAIT; |
| 332 | if (!(t->status & (THREADSTATUS_WAITSUSPEND | THREADSTATUS_DORMANT | THREADSTATUS_DEAD))) { | 332 | if (!(t->status & (THREADSTATUS_WAITSUSPEND | THREADSTATUS_DORMANT | THREADSTATUS_DEAD))) { |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index eca84c718..207a5227b 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -23,10 +23,10 @@ enum ThreadProcessorId { | |||
| 23 | 23 | ||
| 24 | /// Creates a new thread - wrapper for external user | 24 | /// Creates a new thread - wrapper for external user |
| 25 | Handle __KernelCreateThread(const char *name, u32 entry_point, s32 priority, | 25 | Handle __KernelCreateThread(const char *name, u32 entry_point, s32 priority, |
| 26 | s32 processor_id, u32 stack_top, int stack_size=KERNEL_DEFAULT_STACK_SIZE); | 26 | s32 processor_id, u32 stack_top, int stack_size=Kernel::DEFAULT_STACK_SIZE); |
| 27 | 27 | ||
| 28 | /// Sets up the primary application thread | 28 | /// Sets up the primary application thread |
| 29 | Handle __KernelSetupMainThread(s32 priority, int stack_size=KERNEL_DEFAULT_STACK_SIZE); | 29 | Handle __KernelSetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE); |
| 30 | 30 | ||
| 31 | /// Reschedules to the next available thread (call after current thread is suspended) | 31 | /// Reschedules to the next available thread (call after current thread is suspended) |
| 32 | void __KernelReschedule(const char *reason); | 32 | void __KernelReschedule(const char *reason); |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index b3e414e0f..08d0c43ff 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -34,7 +34,7 @@ Manager::~Manager() { | |||
| 34 | 34 | ||
| 35 | /// Add a service to the manager (does not create it though) | 35 | /// Add a service to the manager (does not create it though) |
| 36 | void Manager::AddService(Interface* service) { | 36 | void Manager::AddService(Interface* service) { |
| 37 | m_port_map[service->GetPortName()] = g_kernel_objects.Create(service); | 37 | m_port_map[service->GetPortName()] = Kernel::g_object_pool.Create(service); |
| 38 | m_services.push_back(service); | 38 | m_services.push_back(service); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| @@ -48,7 +48,7 @@ void Manager::DeleteService(std::string port_name) { | |||
| 48 | 48 | ||
| 49 | /// Get a Service Interface from its Handle | 49 | /// Get a Service Interface from its Handle |
| 50 | Interface* Manager::FetchFromHandle(Handle handle) { | 50 | Interface* Manager::FetchFromHandle(Handle handle) { |
| 51 | return g_kernel_objects.GetFast<Interface>(handle); | 51 | return Kernel::g_object_pool.GetFast<Interface>(handle); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /// Get a Service Interface from its port | 54 | /// Get a Service Interface from its port |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 450a439fe..f334dbcb8 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -36,15 +36,15 @@ inline static u32* GetCommandBuffer(const int offset=0) { | |||
| 36 | class Manager; | 36 | class Manager; |
| 37 | 37 | ||
| 38 | /// Interface to a CTROS service | 38 | /// Interface to a CTROS service |
| 39 | class Interface : public KernelObject { | 39 | class Interface : public Kernel::Object { |
| 40 | friend class Manager; | 40 | friend class Manager; |
| 41 | public: | 41 | public: |
| 42 | 42 | ||
| 43 | const char *GetName() { return GetPortName(); } | 43 | const char *GetName() { return GetPortName(); } |
| 44 | const char *GetTypeName() { return GetPortName(); } | 44 | const char *GetTypeName() { return GetPortName(); } |
| 45 | 45 | ||
| 46 | static KernelIDType GetStaticIDType() { return KERNEL_ID_TYPE_THREAD; } | 46 | static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Service; } |
| 47 | KernelIDType GetIDType() const { return KERNEL_ID_TYPE_THREAD; } | 47 | Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Service; } |
| 48 | 48 | ||
| 49 | typedef void (*Function)(Interface*); | 49 | typedef void (*Function)(Interface*); |
| 50 | 50 | ||
| @@ -63,8 +63,8 @@ public: | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | /// Allocates a new handle for the service | 65 | /// Allocates a new handle for the service |
| 66 | Handle CreateHandle(KernelObject *obj) { | 66 | Handle CreateHandle(Kernel::Object *obj) { |
| 67 | Handle handle = g_kernel_objects.Create(obj); | 67 | Handle handle = Kernel::g_object_pool.Create(obj); |
| 68 | m_handles.push_back(handle); | 68 | m_handles.push_back(handle); |
| 69 | return handle; | 69 | return handle; |
| 70 | } | 70 | } |
| @@ -72,7 +72,7 @@ public: | |||
| 72 | /// Frees a handle from the service | 72 | /// Frees a handle from the service |
| 73 | template <class T> | 73 | template <class T> |
| 74 | void DeleteHandle(const Handle handle) { | 74 | void DeleteHandle(const Handle handle) { |
| 75 | g_kernel_objects.Destroy<T>(handle); | 75 | g_object_pool.Destroy<T>(handle); |
| 76 | m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end()); | 76 | m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end()); |
| 77 | } | 77 | } |
| 78 | 78 | ||