summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2014-12-13 21:16:13 -0200
committerGravatar Yuri Kunde Schlesner2014-12-28 11:52:52 -0200
commit73fba22c019562687c6e14f20ca7422020f7e070 (patch)
tree605504e9e6306752023ce8bfbff9599c2eab957e /src/core
parentMerge pull request #349 from lioncash/uhdync (diff)
downloadyuzu-73fba22c019562687c6e14f20ca7422020f7e070.tar.gz
yuzu-73fba22c019562687c6e14f20ca7422020f7e070.tar.xz
yuzu-73fba22c019562687c6e14f20ca7422020f7e070.zip
Rename ObjectPool to HandleTable
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp2
-rw-r--r--src/core/hle/kernel/event.cpp10
-rw-r--r--src/core/hle/kernel/kernel.cpp20
-rw-r--r--src/core/hle/kernel/kernel.h12
-rw-r--r--src/core/hle/kernel/mutex.cpp6
-rw-r--r--src/core/hle/kernel/semaphore.cpp4
-rw-r--r--src/core/hle/kernel/shared_memory.cpp6
-rw-r--r--src/core/hle/kernel/thread.cpp22
-rw-r--r--src/core/hle/service/fs/archive.cpp8
-rw-r--r--src/core/hle/service/service.cpp4
-rw-r--r--src/core/hle/service/service.h4
-rw-r--r--src/core/hle/svc.cpp10
12 files changed, 54 insertions, 54 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index 77491900a..daddd8db2 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -62,7 +62,7 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3
62/// Create an address arbiter 62/// Create an address arbiter
63AddressArbiter* CreateAddressArbiter(Handle& handle, const std::string& name) { 63AddressArbiter* CreateAddressArbiter(Handle& handle, const std::string& name) {
64 AddressArbiter* address_arbiter = new AddressArbiter; 64 AddressArbiter* address_arbiter = new AddressArbiter;
65 handle = Kernel::g_object_pool.Create(address_arbiter); 65 handle = Kernel::g_handle_table.Create(address_arbiter);
66 address_arbiter->name = name; 66 address_arbiter->name = name;
67 return address_arbiter; 67 return address_arbiter;
68} 68}
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index 4de3fab3c..0ff1515d2 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -53,7 +53,7 @@ public:
53 * @return Result of operation, 0 on success, otherwise error code 53 * @return Result of operation, 0 on success, otherwise error code
54 */ 54 */
55ResultCode SetPermanentLock(Handle handle, const bool permanent_locked) { 55ResultCode SetPermanentLock(Handle handle, const bool permanent_locked) {
56 Event* evt = g_object_pool.Get<Event>(handle); 56 Event* evt = g_handle_table.Get<Event>(handle);
57 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); 57 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
58 58
59 evt->permanent_locked = permanent_locked; 59 evt->permanent_locked = permanent_locked;
@@ -67,7 +67,7 @@ ResultCode SetPermanentLock(Handle handle, const bool permanent_locked) {
67 * @return Result of operation, 0 on success, otherwise error code 67 * @return Result of operation, 0 on success, otherwise error code
68 */ 68 */
69ResultCode SetEventLocked(const Handle handle, const bool locked) { 69ResultCode SetEventLocked(const Handle handle, const bool locked) {
70 Event* evt = g_object_pool.Get<Event>(handle); 70 Event* evt = g_handle_table.Get<Event>(handle);
71 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); 71 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
72 72
73 if (!evt->permanent_locked) { 73 if (!evt->permanent_locked) {
@@ -82,7 +82,7 @@ ResultCode SetEventLocked(const Handle handle, const bool locked) {
82 * @return Result of operation, 0 on success, otherwise error code 82 * @return Result of operation, 0 on success, otherwise error code
83 */ 83 */
84ResultCode SignalEvent(const Handle handle) { 84ResultCode SignalEvent(const Handle handle) {
85 Event* evt = g_object_pool.Get<Event>(handle); 85 Event* evt = g_handle_table.Get<Event>(handle);
86 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); 86 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
87 87
88 // Resume threads waiting for event to signal 88 // Resume threads waiting for event to signal
@@ -110,7 +110,7 @@ ResultCode SignalEvent(const Handle handle) {
110 * @return Result of operation, 0 on success, otherwise error code 110 * @return Result of operation, 0 on success, otherwise error code
111 */ 111 */
112ResultCode ClearEvent(Handle handle) { 112ResultCode ClearEvent(Handle handle) {
113 Event* evt = g_object_pool.Get<Event>(handle); 113 Event* evt = g_handle_table.Get<Event>(handle);
114 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); 114 if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel);
115 115
116 if (!evt->permanent_locked) { 116 if (!evt->permanent_locked) {
@@ -129,7 +129,7 @@ ResultCode ClearEvent(Handle handle) {
129Event* CreateEvent(Handle& handle, const ResetType reset_type, const std::string& name) { 129Event* CreateEvent(Handle& handle, const ResetType reset_type, const std::string& name) {
130 Event* evt = new Event; 130 Event* evt = new Event;
131 131
132 handle = Kernel::g_object_pool.Create(evt); 132 handle = Kernel::g_handle_table.Create(evt);
133 133
134 evt->locked = true; 134 evt->locked = true;
135 evt->permanent_locked = false; 135 evt->permanent_locked = false;
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 5fd06046e..e8bf83a44 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -13,14 +13,14 @@
13namespace Kernel { 13namespace Kernel {
14 14
15Handle g_main_thread = 0; 15Handle g_main_thread = 0;
16ObjectPool g_object_pool; 16HandleTable g_handle_table;
17u64 g_program_id = 0; 17u64 g_program_id = 0;
18 18
19ObjectPool::ObjectPool() { 19HandleTable::HandleTable() {
20 next_id = INITIAL_NEXT_ID; 20 next_id = INITIAL_NEXT_ID;
21} 21}
22 22
23Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) { 23Handle HandleTable::Create(Object* obj, int range_bottom, int range_top) {
24 if (range_top > MAX_COUNT) { 24 if (range_top > MAX_COUNT) {
25 range_top = MAX_COUNT; 25 range_top = MAX_COUNT;
26 } 26 }
@@ -39,7 +39,7 @@ Handle ObjectPool::Create(Object* obj, int range_bottom, int range_top) {
39 return 0; 39 return 0;
40} 40}
41 41
42bool ObjectPool::IsValid(Handle handle) const { 42bool HandleTable::IsValid(Handle handle) const {
43 int index = handle - HANDLE_OFFSET; 43 int index = handle - HANDLE_OFFSET;
44 if (index < 0) 44 if (index < 0)
45 return false; 45 return false;
@@ -49,7 +49,7 @@ bool ObjectPool::IsValid(Handle handle) const {
49 return occupied[index]; 49 return occupied[index];
50} 50}
51 51
52void ObjectPool::Clear() { 52void HandleTable::Clear() {
53 for (int i = 0; i < MAX_COUNT; i++) { 53 for (int i = 0; i < MAX_COUNT; i++) {
54 //brutally clear everything, no validation 54 //brutally clear everything, no validation
55 if (occupied[i]) 55 if (occupied[i])
@@ -60,13 +60,13 @@ void ObjectPool::Clear() {
60 next_id = INITIAL_NEXT_ID; 60 next_id = INITIAL_NEXT_ID;
61} 61}
62 62
63Object* &ObjectPool::operator [](Handle handle) 63Object* &HandleTable::operator [](Handle handle)
64{ 64{
65 _dbg_assert_msg_(Kernel, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); 65 _dbg_assert_msg_(Kernel, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ");
66 return pool[handle - HANDLE_OFFSET]; 66 return pool[handle - HANDLE_OFFSET];
67} 67}
68 68
69void ObjectPool::List() { 69void HandleTable::List() {
70 for (int i = 0; i < MAX_COUNT; i++) { 70 for (int i = 0; i < MAX_COUNT; i++) {
71 if (occupied[i]) { 71 if (occupied[i]) {
72 if (pool[i]) { 72 if (pool[i]) {
@@ -77,11 +77,11 @@ void ObjectPool::List() {
77 } 77 }
78} 78}
79 79
80int ObjectPool::GetCount() const { 80int HandleTable::GetCount() const {
81 return std::count(occupied.begin(), occupied.end(), true); 81 return std::count(occupied.begin(), occupied.end(), true);
82} 82}
83 83
84Object* ObjectPool::CreateByIDType(int type) { 84Object* HandleTable::CreateByIDType(int type) {
85 LOG_ERROR(Kernel, "Unimplemented: %d.", type); 85 LOG_ERROR(Kernel, "Unimplemented: %d.", type);
86 return nullptr; 86 return nullptr;
87} 87}
@@ -95,7 +95,7 @@ void Init() {
95void Shutdown() { 95void Shutdown() {
96 Kernel::ThreadingShutdown(); 96 Kernel::ThreadingShutdown();
97 97
98 g_object_pool.Clear(); // Free all kernel objects 98 g_handle_table.Clear(); // Free all kernel objects
99} 99}
100 100
101/** 101/**
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 32258d5a0..20994b926 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -41,10 +41,10 @@ enum {
41 DEFAULT_STACK_SIZE = 0x4000, 41 DEFAULT_STACK_SIZE = 0x4000,
42}; 42};
43 43
44class ObjectPool; 44class HandleTable;
45 45
46class Object : NonCopyable { 46class Object : NonCopyable {
47 friend class ObjectPool; 47 friend class HandleTable;
48 u32 handle; 48 u32 handle;
49public: 49public:
50 virtual ~Object() {} 50 virtual ~Object() {}
@@ -63,10 +63,10 @@ public:
63 } 63 }
64}; 64};
65 65
66class ObjectPool : NonCopyable { 66class HandleTable : NonCopyable {
67public: 67public:
68 ObjectPool(); 68 HandleTable();
69 ~ObjectPool() {} 69 ~HandleTable() {}
70 70
71 // Allocates a handle within the range and inserts the object into the map. 71 // Allocates a handle within the range and inserts the object into the map.
72 Handle Create(Object* obj, int range_bottom=INITIAL_NEXT_ID, int range_top=0x7FFFFFFF); 72 Handle Create(Object* obj, int range_bottom=INITIAL_NEXT_ID, int range_top=0x7FFFFFFF);
@@ -160,7 +160,7 @@ private:
160 int next_id; 160 int next_id;
161}; 161};
162 162
163extern ObjectPool g_object_pool; 163extern HandleTable g_handle_table;
164extern Handle g_main_thread; 164extern Handle g_main_thread;
165 165
166/// The ID code of the currently running game 166/// The ID code of the currently running game
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 5a18af114..abfe178a0 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -87,7 +87,7 @@ void ReleaseThreadMutexes(Handle thread) {
87 87
88 // Release every mutex that the thread holds, and resume execution on the waiting threads 88 // Release every mutex that the thread holds, and resume execution on the waiting threads
89 for (MutexMap::iterator iter = locked.first; iter != locked.second; ++iter) { 89 for (MutexMap::iterator iter = locked.first; iter != locked.second; ++iter) {
90 Mutex* mutex = g_object_pool.GetFast<Mutex>(iter->second); 90 Mutex* mutex = g_handle_table.GetFast<Mutex>(iter->second);
91 ResumeWaitingThread(mutex); 91 ResumeWaitingThread(mutex);
92 } 92 }
93 93
@@ -115,7 +115,7 @@ bool ReleaseMutex(Mutex* mutex) {
115 * @param handle Handle to mutex to release 115 * @param handle Handle to mutex to release
116 */ 116 */
117ResultCode ReleaseMutex(Handle handle) { 117ResultCode ReleaseMutex(Handle handle) {
118 Mutex* mutex = Kernel::g_object_pool.Get<Mutex>(handle); 118 Mutex* mutex = Kernel::g_handle_table.Get<Mutex>(handle);
119 if (mutex == nullptr) return InvalidHandle(ErrorModule::Kernel); 119 if (mutex == nullptr) return InvalidHandle(ErrorModule::Kernel);
120 120
121 if (!ReleaseMutex(mutex)) { 121 if (!ReleaseMutex(mutex)) {
@@ -136,7 +136,7 @@ ResultCode ReleaseMutex(Handle handle) {
136 */ 136 */
137Mutex* CreateMutex(Handle& handle, bool initial_locked, const std::string& name) { 137Mutex* CreateMutex(Handle& handle, bool initial_locked, const std::string& name) {
138 Mutex* mutex = new Mutex; 138 Mutex* mutex = new Mutex;
139 handle = Kernel::g_object_pool.Create(mutex); 139 handle = Kernel::g_handle_table.Create(mutex);
140 140
141 mutex->locked = mutex->initial_locked = initial_locked; 141 mutex->locked = mutex->initial_locked = initial_locked;
142 mutex->name = name; 142 mutex->name = name;
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp
index b81d0b26a..cb7b5f181 100644
--- a/src/core/hle/kernel/semaphore.cpp
+++ b/src/core/hle/kernel/semaphore.cpp
@@ -57,7 +57,7 @@ ResultCode CreateSemaphore(Handle* handle, s32 initial_count,
57 ErrorSummary::WrongArgument, ErrorLevel::Permanent); 57 ErrorSummary::WrongArgument, ErrorLevel::Permanent);
58 58
59 Semaphore* semaphore = new Semaphore; 59 Semaphore* semaphore = new Semaphore;
60 *handle = g_object_pool.Create(semaphore); 60 *handle = g_handle_table.Create(semaphore);
61 61
62 // When the semaphore is created, some slots are reserved for other threads, 62 // When the semaphore is created, some slots are reserved for other threads,
63 // and the rest is reserved for the caller thread 63 // and the rest is reserved for the caller thread
@@ -69,7 +69,7 @@ ResultCode CreateSemaphore(Handle* handle, s32 initial_count,
69} 69}
70 70
71ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) { 71ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
72 Semaphore* semaphore = g_object_pool.Get<Semaphore>(handle); 72 Semaphore* semaphore = g_handle_table.Get<Semaphore>(handle);
73 if (semaphore == nullptr) 73 if (semaphore == nullptr)
74 return InvalidHandle(ErrorModule::Kernel); 74 return InvalidHandle(ErrorModule::Kernel);
75 75
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index 2840f13bb..5138bb7ae 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -32,7 +32,7 @@ public:
32 */ 32 */
33SharedMemory* CreateSharedMemory(Handle& handle, const std::string& name) { 33SharedMemory* CreateSharedMemory(Handle& handle, const std::string& name) {
34 SharedMemory* shared_memory = new SharedMemory; 34 SharedMemory* shared_memory = new SharedMemory;
35 handle = Kernel::g_object_pool.Create(shared_memory); 35 handle = Kernel::g_handle_table.Create(shared_memory);
36 shared_memory->name = name; 36 shared_memory->name = name;
37 return shared_memory; 37 return shared_memory;
38} 38}
@@ -60,7 +60,7 @@ ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions
60 return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, 60 return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel,
61 ErrorSummary::InvalidArgument, ErrorLevel::Permanent); 61 ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
62 } 62 }
63 SharedMemory* shared_memory = Kernel::g_object_pool.Get<SharedMemory>(handle); 63 SharedMemory* shared_memory = Kernel::g_handle_table.Get<SharedMemory>(handle);
64 if (shared_memory == nullptr) return InvalidHandle(ErrorModule::Kernel); 64 if (shared_memory == nullptr) return InvalidHandle(ErrorModule::Kernel);
65 65
66 shared_memory->base_address = address; 66 shared_memory->base_address = address;
@@ -71,7 +71,7 @@ ResultCode MapSharedMemory(u32 handle, u32 address, MemoryPermission permissions
71} 71}
72 72
73ResultVal<u8*> GetSharedMemoryPointer(Handle handle, u32 offset) { 73ResultVal<u8*> GetSharedMemoryPointer(Handle handle, u32 offset) {
74 SharedMemory* shared_memory = Kernel::g_object_pool.Get<SharedMemory>(handle); 74 SharedMemory* shared_memory = Kernel::g_handle_table.Get<SharedMemory>(handle);
75 if (shared_memory == nullptr) return InvalidHandle(ErrorModule::Kernel); 75 if (shared_memory == nullptr) return InvalidHandle(ErrorModule::Kernel);
76 76
77 if (0 != shared_memory->base_address) 77 if (0 != shared_memory->base_address)
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index c6a8dc7b9..c89d9433a 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -164,7 +164,7 @@ static bool CheckWaitType(const Thread* thread, WaitType type, Handle wait_handl
164 164
165/// Stops the current thread 165/// Stops the current thread
166ResultCode StopThread(Handle handle, const char* reason) { 166ResultCode StopThread(Handle handle, const char* reason) {
167 Thread* thread = g_object_pool.Get<Thread>(handle); 167 Thread* thread = g_handle_table.Get<Thread>(handle);
168 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel); 168 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel);
169 169
170 // Release all the mutexes that this thread holds 170 // Release all the mutexes that this thread holds
@@ -173,7 +173,7 @@ ResultCode StopThread(Handle handle, const char* reason) {
173 ChangeReadyState(thread, false); 173 ChangeReadyState(thread, false);
174 thread->status = THREADSTATUS_DORMANT; 174 thread->status = THREADSTATUS_DORMANT;
175 for (Handle waiting_handle : thread->waiting_threads) { 175 for (Handle waiting_handle : thread->waiting_threads) {
176 Thread* waiting_thread = g_object_pool.Get<Thread>(waiting_handle); 176 Thread* waiting_thread = g_handle_table.Get<Thread>(waiting_handle);
177 177
178 if (CheckWaitType(waiting_thread, WAITTYPE_THREADEND, handle)) 178 if (CheckWaitType(waiting_thread, WAITTYPE_THREADEND, handle))
179 ResumeThreadFromWait(waiting_handle); 179 ResumeThreadFromWait(waiting_handle);
@@ -210,7 +210,7 @@ Handle ArbitrateHighestPriorityThread(u32 arbiter, u32 address) {
210 210
211 // Iterate through threads, find highest priority thread that is waiting to be arbitrated... 211 // Iterate through threads, find highest priority thread that is waiting to be arbitrated...
212 for (Handle handle : thread_queue) { 212 for (Handle handle : thread_queue) {
213 Thread* thread = g_object_pool.Get<Thread>(handle); 213 Thread* thread = g_handle_table.Get<Thread>(handle);
214 214
215 if (!CheckWaitType(thread, WAITTYPE_ARB, arbiter, address)) 215 if (!CheckWaitType(thread, WAITTYPE_ARB, arbiter, address))
216 continue; 216 continue;
@@ -235,7 +235,7 @@ void ArbitrateAllThreads(u32 arbiter, u32 address) {
235 235
236 // Iterate through threads, find highest priority thread that is waiting to be arbitrated... 236 // Iterate through threads, find highest priority thread that is waiting to be arbitrated...
237 for (Handle handle : thread_queue) { 237 for (Handle handle : thread_queue) {
238 Thread* thread = g_object_pool.Get<Thread>(handle); 238 Thread* thread = g_handle_table.Get<Thread>(handle);
239 239
240 if (CheckWaitType(thread, WAITTYPE_ARB, arbiter, address)) 240 if (CheckWaitType(thread, WAITTYPE_ARB, arbiter, address))
241 ResumeThreadFromWait(handle); 241 ResumeThreadFromWait(handle);
@@ -288,7 +288,7 @@ Thread* NextThread() {
288 if (next == 0) { 288 if (next == 0) {
289 return nullptr; 289 return nullptr;
290 } 290 }
291 return Kernel::g_object_pool.Get<Thread>(next); 291 return Kernel::g_handle_table.Get<Thread>(next);
292} 292}
293 293
294void WaitCurrentThread(WaitType wait_type, Handle wait_handle) { 294void WaitCurrentThread(WaitType wait_type, Handle wait_handle) {
@@ -305,7 +305,7 @@ void WaitCurrentThread(WaitType wait_type, Handle wait_handle, VAddr wait_addres
305 305
306/// Resumes a thread from waiting by marking it as "ready" 306/// Resumes a thread from waiting by marking it as "ready"
307void ResumeThreadFromWait(Handle handle) { 307void ResumeThreadFromWait(Handle handle) {
308 Thread* thread = Kernel::g_object_pool.Get<Thread>(handle); 308 Thread* thread = Kernel::g_handle_table.Get<Thread>(handle);
309 if (thread) { 309 if (thread) {
310 thread->status &= ~THREADSTATUS_WAIT; 310 thread->status &= ~THREADSTATUS_WAIT;
311 thread->wait_handle = 0; 311 thread->wait_handle = 0;
@@ -341,7 +341,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio
341 341
342 Thread* thread = new Thread; 342 Thread* thread = new Thread;
343 343
344 handle = Kernel::g_object_pool.Create(thread); 344 handle = Kernel::g_handle_table.Create(thread);
345 345
346 thread_queue.push_back(handle); 346 thread_queue.push_back(handle);
347 thread_ready_queue.prepare(priority); 347 thread_ready_queue.prepare(priority);
@@ -398,7 +398,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3
398 398
399/// Get the priority of the thread specified by handle 399/// Get the priority of the thread specified by handle
400ResultVal<u32> GetThreadPriority(const Handle handle) { 400ResultVal<u32> GetThreadPriority(const Handle handle) {
401 Thread* thread = g_object_pool.Get<Thread>(handle); 401 Thread* thread = g_handle_table.Get<Thread>(handle);
402 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel); 402 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel);
403 403
404 return MakeResult<u32>(thread->current_priority); 404 return MakeResult<u32>(thread->current_priority);
@@ -410,7 +410,7 @@ ResultCode SetThreadPriority(Handle handle, s32 priority) {
410 if (!handle) { 410 if (!handle) {
411 thread = GetCurrentThread(); // TODO(bunnei): Is this correct behavior? 411 thread = GetCurrentThread(); // TODO(bunnei): Is this correct behavior?
412 } else { 412 } else {
413 thread = g_object_pool.Get<Thread>(handle); 413 thread = g_handle_table.Get<Thread>(handle);
414 if (thread == nullptr) { 414 if (thread == nullptr) {
415 return InvalidHandle(ErrorModule::Kernel); 415 return InvalidHandle(ErrorModule::Kernel);
416 } 416 }
@@ -481,7 +481,7 @@ void Reschedule() {
481 LOG_TRACE(Kernel, "cannot context switch from 0x%08X, no higher priority thread!", prev->GetHandle()); 481 LOG_TRACE(Kernel, "cannot context switch from 0x%08X, no higher priority thread!", prev->GetHandle());
482 482
483 for (Handle handle : thread_queue) { 483 for (Handle handle : thread_queue) {
484 Thread* thread = g_object_pool.Get<Thread>(handle); 484 Thread* thread = g_handle_table.Get<Thread>(handle);
485 LOG_TRACE(Kernel, "\thandle=0x%08X prio=0x%02X, status=0x%08X wait_type=0x%08X wait_handle=0x%08X", 485 LOG_TRACE(Kernel, "\thandle=0x%08X prio=0x%02X, status=0x%08X wait_type=0x%08X wait_handle=0x%08X",
486 thread->GetHandle(), thread->current_priority, thread->status, thread->wait_type, thread->wait_handle); 486 thread->GetHandle(), thread->current_priority, thread->status, thread->wait_type, thread->wait_handle);
487 } 487 }
@@ -497,7 +497,7 @@ void Reschedule() {
497} 497}
498 498
499ResultCode GetThreadId(u32* thread_id, Handle handle) { 499ResultCode GetThreadId(u32* thread_id, Handle handle) {
500 Thread* thread = g_object_pool.Get<Thread>(handle); 500 Thread* thread = g_handle_table.Get<Thread>(handle);
501 if (thread == nullptr) 501 if (thread == nullptr)
502 return ResultCode(ErrorDescription::InvalidHandle, ErrorModule::OS, 502 return ResultCode(ErrorDescription::InvalidHandle, ErrorModule::OS,
503 ErrorSummary::WrongArgument, ErrorLevel::Permanent); 503 ErrorSummary::WrongArgument, ErrorLevel::Permanent);
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 98db02f15..5746b58e5 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -133,7 +133,7 @@ public:
133 case FileCommand::Close: 133 case FileCommand::Close:
134 { 134 {
135 LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); 135 LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
136 Kernel::g_object_pool.Destroy<File>(GetHandle()); 136 Kernel::g_handle_table.Destroy<File>(GetHandle());
137 break; 137 break;
138 } 138 }
139 139
@@ -189,7 +189,7 @@ public:
189 case DirectoryCommand::Close: 189 case DirectoryCommand::Close:
190 { 190 {
191 LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str()); 191 LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
192 Kernel::g_object_pool.Destroy<Directory>(GetHandle()); 192 Kernel::g_handle_table.Destroy<Directory>(GetHandle());
193 break; 193 break;
194 } 194 }
195 195
@@ -283,7 +283,7 @@ ResultVal<Handle> OpenFileFromArchive(ArchiveHandle archive_handle, const FileSy
283 } 283 }
284 284
285 auto file = Common::make_unique<File>(std::move(backend), path); 285 auto file = Common::make_unique<File>(std::move(backend), path);
286 Handle handle = Kernel::g_object_pool.Create(file.release()); 286 Handle handle = Kernel::g_handle_table.Create(file.release());
287 return MakeResult<Handle>(handle); 287 return MakeResult<Handle>(handle);
288} 288}
289 289
@@ -388,7 +388,7 @@ ResultVal<Handle> OpenDirectoryFromArchive(ArchiveHandle archive_handle, const F
388 } 388 }
389 389
390 auto directory = Common::make_unique<Directory>(std::move(backend), path); 390 auto directory = Common::make_unique<Directory>(std::move(backend), path);
391 Handle handle = Kernel::g_object_pool.Create(directory.release()); 391 Handle handle = Kernel::g_handle_table.Create(directory.release());
392 return MakeResult<Handle>(handle); 392 return MakeResult<Handle>(handle);
393} 393}
394 394
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 44e4fbcb2..e9a7973b3 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -56,7 +56,7 @@ Manager::~Manager() {
56 56
57/// Add a service to the manager (does not create it though) 57/// Add a service to the manager (does not create it though)
58void Manager::AddService(Interface* service) { 58void Manager::AddService(Interface* service) {
59 m_port_map[service->GetPortName()] = Kernel::g_object_pool.Create(service); 59 m_port_map[service->GetPortName()] = Kernel::g_handle_table.Create(service);
60 m_services.push_back(service); 60 m_services.push_back(service);
61} 61}
62 62
@@ -70,7 +70,7 @@ void Manager::DeleteService(const std::string& port_name) {
70 70
71/// Get a Service Interface from its Handle 71/// Get a Service Interface from its Handle
72Interface* Manager::FetchFromHandle(Handle handle) { 72Interface* Manager::FetchFromHandle(Handle handle) {
73 return Kernel::g_object_pool.Get<Interface>(handle); 73 return Kernel::g_handle_table.Get<Interface>(handle);
74} 74}
75 75
76/// Get a Service Interface from its port 76/// Get a Service Interface from its port
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 0616822fa..9d5828fd0 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -54,7 +54,7 @@ public:
54 54
55 /// Allocates a new handle for the service 55 /// Allocates a new handle for the service
56 Handle CreateHandle(Kernel::Object *obj) { 56 Handle CreateHandle(Kernel::Object *obj) {
57 Handle handle = Kernel::g_object_pool.Create(obj); 57 Handle handle = Kernel::g_handle_table.Create(obj);
58 m_handles.push_back(handle); 58 m_handles.push_back(handle);
59 return handle; 59 return handle;
60 } 60 }
@@ -62,7 +62,7 @@ public:
62 /// Frees a handle from the service 62 /// Frees a handle from the service
63 template <class T> 63 template <class T>
64 void DeleteHandle(const Handle handle) { 64 void DeleteHandle(const Handle handle) {
65 Kernel::g_object_pool.Destroy<T>(handle); 65 Kernel::g_handle_table.Destroy<T>(handle);
66 m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end()); 66 m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end());
67 } 67 }
68 68
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index c98168e51..a48ac09a3 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -92,7 +92,7 @@ static Result ConnectToPort(Handle* out, const char* port_name) {
92 92
93/// Synchronize to an OS service 93/// Synchronize to an OS service
94static Result SendSyncRequest(Handle handle) { 94static Result SendSyncRequest(Handle handle) {
95 Kernel::Session* session = Kernel::g_object_pool.Get<Kernel::Session>(handle); 95 Kernel::Session* session = Kernel::g_handle_table.Get<Kernel::Session>(handle);
96 if (session == nullptr) { 96 if (session == nullptr) {
97 return InvalidHandle(ErrorModule::Kernel).raw; 97 return InvalidHandle(ErrorModule::Kernel).raw;
98 } 98 }
@@ -119,10 +119,10 @@ static Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
119 // TODO(bunnei): Do something with nano_seconds, currently ignoring this 119 // TODO(bunnei): Do something with nano_seconds, currently ignoring this
120 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated 120 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated
121 121
122 if (!Kernel::g_object_pool.IsValid(handle)) { 122 if (!Kernel::g_handle_table.IsValid(handle)) {
123 return InvalidHandle(ErrorModule::Kernel).raw; 123 return InvalidHandle(ErrorModule::Kernel).raw;
124 } 124 }
125 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle); 125 Kernel::Object* object = Kernel::g_handle_table.GetFast<Kernel::Object>(handle);
126 _dbg_assert_(Kernel, object != nullptr); 126 _dbg_assert_(Kernel, object != nullptr);
127 127
128 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(), 128 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s:%s), nanoseconds=%lld", handle, object->GetTypeName().c_str(),
@@ -150,10 +150,10 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
150 150
151 // Iterate through each handle, synchronize kernel object 151 // Iterate through each handle, synchronize kernel object
152 for (s32 i = 0; i < handle_count; i++) { 152 for (s32 i = 0; i < handle_count; i++) {
153 if (!Kernel::g_object_pool.IsValid(handles[i])) { 153 if (!Kernel::g_handle_table.IsValid(handles[i])) {
154 return InvalidHandle(ErrorModule::Kernel).raw; 154 return InvalidHandle(ErrorModule::Kernel).raw;
155 } 155 }
156 Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]); 156 Kernel::Object* object = Kernel::g_handle_table.GetFast<Kernel::Object>(handles[i]);
157 157
158 LOG_TRACE(Kernel_SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(), 158 LOG_TRACE(Kernel_SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName().c_str(),
159 object->GetName().c_str()); 159 object->GetName().c_str());