From 369f6e58aa30fe48e8b1fc484192bfc5223b9ec5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 31 Jul 2018 08:53:13 -0400 Subject: kernel: Remove unused object_address_table.cpp/.h These source files were entirely unused throughout the rest of the codebase. This also has the benefit of getting rid of a global variable as well. --- src/core/CMakeLists.txt | 2 - src/core/hle/kernel/kernel.cpp | 2 - src/core/hle/kernel/mutex.cpp | 1 - src/core/hle/kernel/object_address_table.cpp | 36 ---------------- src/core/hle/kernel/object_address_table.h | 62 ---------------------------- src/core/hle/kernel/svc.cpp | 1 - 6 files changed, 104 deletions(-) delete mode 100644 src/core/hle/kernel/object_address_table.cpp delete mode 100644 src/core/hle/kernel/object_address_table.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 3386c2231..3a4ddc14c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -67,8 +67,6 @@ add_library(core STATIC hle/kernel/memory.h hle/kernel/mutex.cpp hle/kernel/mutex.h - hle/kernel/object_address_table.cpp - hle/kernel/object_address_table.h hle/kernel/process.cpp hle/kernel/process.h hle/kernel/resource_limit.cpp diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 1beb98566..3eb4f465c 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -5,7 +5,6 @@ #include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/memory.h" -#include "core/hle/kernel/object_address_table.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/thread.h" @@ -33,7 +32,6 @@ void Init(u32 system_mode) { void Shutdown() { // Free all kernel objects g_handle_table.Clear(); - g_object_address_table.Clear(); Kernel::ThreadingShutdown(); diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index feb7b88d2..f12c3a5e5 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -11,7 +11,6 @@ #include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/mutex.h" -#include "core/hle/kernel/object_address_table.h" #include "core/hle/kernel/thread.h" namespace Kernel { diff --git a/src/core/hle/kernel/object_address_table.cpp b/src/core/hle/kernel/object_address_table.cpp deleted file mode 100644 index ca8a833a1..000000000 --- a/src/core/hle/kernel/object_address_table.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 yuzu emulator team -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include - -#include "common/assert.h" -#include "core/hle/kernel/object_address_table.h" - -namespace Kernel { - -ObjectAddressTable g_object_address_table; - -void ObjectAddressTable::Insert(VAddr addr, SharedPtr obj) { - ASSERT_MSG(objects.find(addr) == objects.end(), "Object already exists with addr=0x{:X}", addr); - objects[addr] = std::move(obj); -} - -void ObjectAddressTable::Close(VAddr addr) { - ASSERT_MSG(objects.find(addr) != objects.end(), "Object does not exist with addr=0x{:X}", addr); - objects.erase(addr); -} - -SharedPtr ObjectAddressTable::GetGeneric(VAddr addr) const { - auto iter = objects.find(addr); - if (iter != objects.end()) { - return iter->second; - } - return {}; -} - -void ObjectAddressTable::Clear() { - objects.clear(); -} - -} // namespace Kernel diff --git a/src/core/hle/kernel/object_address_table.h b/src/core/hle/kernel/object_address_table.h deleted file mode 100644 index a09004b32..000000000 --- a/src/core/hle/kernel/object_address_table.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2018 yuzu emulator team -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include -#include "common/common_types.h" -#include "core/hle/kernel/kernel.h" - -namespace Kernel { - -/** - * This class is used to keep a table of Kernel objects and their respective addresses in emulated - * memory. For certain Switch SVCs, Kernel objects are referenced by an address to an object the - * guest application manages, so we use this table to look these kernel objects up. This is similiar - * to the HandleTable class. - */ -class ObjectAddressTable final : NonCopyable { -public: - ObjectAddressTable() = default; - - /** - * Inserts an object and address pair into the table. - */ - void Insert(VAddr addr, SharedPtr obj); - - /** - * Closes an object by its address, removing it from the table and decreasing the object's - * ref-count. - * @return `RESULT_SUCCESS` or one of the following errors: - * - `ERR_INVALID_HANDLE`: an invalid handle was passed in. - */ - void Close(VAddr addr); - - /** - * Looks up an object by its address. - * @return Pointer to the looked-up object, or `nullptr` if the handle is not valid. - */ - SharedPtr GetGeneric(VAddr addr) const; - - /** - * Looks up an object by its address while verifying its type. - * @return Pointer to the looked-up object, or `nullptr` if the handle is not valid or its - * type differs from the requested one. - */ - template - SharedPtr Get(VAddr addr) const { - return DynamicObjectCast(GetGeneric(addr)); - } - - /// Closes all addresses held in this table. - void Clear(); - -private: - /// Stores the Object referenced by the address - std::map> objects; -}; - -extern ObjectAddressTable g_object_address_table; - -} // namespace Kernel diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 0b439401a..0488cf286 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -17,7 +17,6 @@ #include "core/hle/kernel/event.h" #include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/mutex.h" -#include "core/hle/kernel/object_address_table.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/shared_memory.h" -- cgit v1.2.3