diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/common_types.h | 10 | ||||
| -rw-r--r-- | src/common/telemetry.h | 26 | ||||
| -rw-r--r-- | src/core/arm/arm_interface.h | 6 | ||||
| -rw-r--r-- | src/core/file_sys/vfs.h | 18 | ||||
| -rw-r--r-- | src/core/hid/emulated_console.h | 1 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.h | 2 | ||||
| -rw-r--r-- | src/core/hid/hid_core.h | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_auto_object.h | 7 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_auto_object_container.h | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_handle_table.h | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_memory_manager.h | 42 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_memory_region.h | 80 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_page_heap.h | 90 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_page_table.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_page_table.h | 7 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_slab_heap.h | 13 | ||||
| -rw-r--r-- | src/core/hle/service/vi/display/vi_display.h | 2 | ||||
| -rw-r--r-- | src/core/loader/loader.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_base.h | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_resource_manager.h | 50 |
20 files changed, 228 insertions, 150 deletions
diff --git a/src/common/common_types.h b/src/common/common_types.h index 4cec89fbd..99bffc460 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h | |||
| @@ -46,13 +46,3 @@ using GPUVAddr = u64; ///< Represents a pointer in the GPU virtual address space | |||
| 46 | 46 | ||
| 47 | using u128 = std::array<std::uint64_t, 2>; | 47 | using u128 = std::array<std::uint64_t, 2>; |
| 48 | static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide"); | 48 | static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide"); |
| 49 | |||
| 50 | // An inheritable class to disallow the copy constructor and operator= functions | ||
| 51 | class NonCopyable { | ||
| 52 | protected: | ||
| 53 | constexpr NonCopyable() = default; | ||
| 54 | ~NonCopyable() = default; | ||
| 55 | |||
| 56 | NonCopyable(const NonCopyable&) = delete; | ||
| 57 | NonCopyable& operator=(const NonCopyable&) = delete; | ||
| 58 | }; | ||
diff --git a/src/common/telemetry.h b/src/common/telemetry.h index 49186e848..d38aeac99 100644 --- a/src/common/telemetry.h +++ b/src/common/telemetry.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <map> | 8 | #include <map> |
| 9 | #include <memory> | 9 | #include <memory> |
| 10 | #include <string> | 10 | #include <string> |
| 11 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 12 | 13 | ||
| 13 | namespace Common::Telemetry { | 14 | namespace Common::Telemetry { |
| @@ -28,7 +29,7 @@ struct VisitorInterface; | |||
| 28 | /** | 29 | /** |
| 29 | * Interface class for telemetry data fields. | 30 | * Interface class for telemetry data fields. |
| 30 | */ | 31 | */ |
| 31 | class FieldInterface : NonCopyable { | 32 | class FieldInterface { |
| 32 | public: | 33 | public: |
| 33 | virtual ~FieldInterface() = default; | 34 | virtual ~FieldInterface() = default; |
| 34 | 35 | ||
| @@ -52,14 +53,15 @@ public: | |||
| 52 | template <typename T> | 53 | template <typename T> |
| 53 | class Field : public FieldInterface { | 54 | class Field : public FieldInterface { |
| 54 | public: | 55 | public: |
| 56 | YUZU_NON_COPYABLE(Field); | ||
| 57 | |||
| 55 | Field(FieldType type_, std::string name_, T value_) | 58 | Field(FieldType type_, std::string name_, T value_) |
| 56 | : name(std::move(name_)), type(type_), value(std::move(value_)) {} | 59 | : name(std::move(name_)), type(type_), value(std::move(value_)) {} |
| 57 | 60 | ||
| 58 | Field(const Field&) = default; | 61 | ~Field() override = default; |
| 59 | Field& operator=(const Field&) = default; | ||
| 60 | 62 | ||
| 61 | Field(Field&&) = default; | 63 | Field(Field&&) noexcept = default; |
| 62 | Field& operator=(Field&& other) = default; | 64 | Field& operator=(Field&& other) noexcept = default; |
| 63 | 65 | ||
| 64 | void Accept(VisitorInterface& visitor) const override; | 66 | void Accept(VisitorInterface& visitor) const override; |
| 65 | 67 | ||
| @@ -98,9 +100,15 @@ private: | |||
| 98 | /** | 100 | /** |
| 99 | * Collection of data fields that have been logged. | 101 | * Collection of data fields that have been logged. |
| 100 | */ | 102 | */ |
| 101 | class FieldCollection final : NonCopyable { | 103 | class FieldCollection final { |
| 102 | public: | 104 | public: |
| 105 | YUZU_NON_COPYABLE(FieldCollection); | ||
| 106 | |||
| 103 | FieldCollection() = default; | 107 | FieldCollection() = default; |
| 108 | ~FieldCollection() = default; | ||
| 109 | |||
| 110 | FieldCollection(FieldCollection&&) noexcept = default; | ||
| 111 | FieldCollection& operator=(FieldCollection&&) noexcept = default; | ||
| 104 | 112 | ||
| 105 | /** | 113 | /** |
| 106 | * Accept method for the visitor pattern, visits each field in the collection. | 114 | * Accept method for the visitor pattern, visits each field in the collection. |
| @@ -133,7 +141,7 @@ private: | |||
| 133 | * Telemetry fields visitor interface class. A backend to log to a web service should implement | 141 | * Telemetry fields visitor interface class. A backend to log to a web service should implement |
| 134 | * this interface. | 142 | * this interface. |
| 135 | */ | 143 | */ |
| 136 | struct VisitorInterface : NonCopyable { | 144 | struct VisitorInterface { |
| 137 | virtual ~VisitorInterface() = default; | 145 | virtual ~VisitorInterface() = default; |
| 138 | 146 | ||
| 139 | virtual void Visit(const Field<bool>& field) = 0; | 147 | virtual void Visit(const Field<bool>& field) = 0; |
| @@ -160,8 +168,8 @@ struct VisitorInterface : NonCopyable { | |||
| 160 | * Empty implementation of VisitorInterface that drops all fields. Used when a functional | 168 | * Empty implementation of VisitorInterface that drops all fields. Used when a functional |
| 161 | * backend implementation is not available. | 169 | * backend implementation is not available. |
| 162 | */ | 170 | */ |
| 163 | struct NullVisitor : public VisitorInterface { | 171 | struct NullVisitor final : public VisitorInterface { |
| 164 | ~NullVisitor() = default; | 172 | YUZU_NON_COPYABLE(NullVisitor); |
| 165 | 173 | ||
| 166 | void Visit(const Field<bool>& /*field*/) override {} | 174 | void Visit(const Field<bool>& /*field*/) override {} |
| 167 | void Visit(const Field<double>& /*field*/) override {} | 175 | void Visit(const Field<double>& /*field*/) override {} |
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 689e3ceb5..c60322442 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include "common/common_funcs.h" | ||
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 10 | #include "core/hardware_properties.h" | 11 | #include "core/hardware_properties.h" |
| 11 | 12 | ||
| @@ -24,8 +25,11 @@ class CPUInterruptHandler; | |||
| 24 | using CPUInterrupts = std::array<CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>; | 25 | using CPUInterrupts = std::array<CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>; |
| 25 | 26 | ||
| 26 | /// Generic ARMv8 CPU interface | 27 | /// Generic ARMv8 CPU interface |
| 27 | class ARM_Interface : NonCopyable { | 28 | class ARM_Interface { |
| 28 | public: | 29 | public: |
| 30 | YUZU_NON_COPYABLE(ARM_Interface); | ||
| 31 | YUZU_NON_MOVEABLE(ARM_Interface); | ||
| 32 | |||
| 29 | explicit ARM_Interface(System& system_, CPUInterrupts& interrupt_handlers_, | 33 | explicit ARM_Interface(System& system_, CPUInterrupts& interrupt_handlers_, |
| 30 | bool uses_wall_clock_) | 34 | bool uses_wall_clock_) |
| 31 | : system{system_}, interrupt_handlers{interrupt_handlers_}, uses_wall_clock{ | 35 | : system{system_}, interrupt_handlers{interrupt_handlers_}, uses_wall_clock{ |
diff --git a/src/core/file_sys/vfs.h b/src/core/file_sys/vfs.h index 3e625fad6..1b9365853 100644 --- a/src/core/file_sys/vfs.h +++ b/src/core/file_sys/vfs.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <type_traits> | 12 | #include <type_traits> |
| 13 | #include <vector> | 13 | #include <vector> |
| 14 | 14 | ||
| 15 | #include "common/common_funcs.h" | ||
| 15 | #include "common/common_types.h" | 16 | #include "common/common_types.h" |
| 16 | #include "core/file_sys/vfs_types.h" | 17 | #include "core/file_sys/vfs_types.h" |
| 17 | 18 | ||
| @@ -29,8 +30,11 @@ enum class VfsEntryType { | |||
| 29 | // A class representing an abstract filesystem. A default implementation given the root VirtualDir | 30 | // A class representing an abstract filesystem. A default implementation given the root VirtualDir |
| 30 | // is provided for convenience, but if the Vfs implementation has any additional state or | 31 | // is provided for convenience, but if the Vfs implementation has any additional state or |
| 31 | // functionality, they will need to override. | 32 | // functionality, they will need to override. |
| 32 | class VfsFilesystem : NonCopyable { | 33 | class VfsFilesystem { |
| 33 | public: | 34 | public: |
| 35 | YUZU_NON_COPYABLE(VfsFilesystem); | ||
| 36 | YUZU_NON_MOVEABLE(VfsFilesystem); | ||
| 37 | |||
| 34 | explicit VfsFilesystem(VirtualDir root); | 38 | explicit VfsFilesystem(VirtualDir root); |
| 35 | virtual ~VfsFilesystem(); | 39 | virtual ~VfsFilesystem(); |
| 36 | 40 | ||
| @@ -77,8 +81,12 @@ protected: | |||
| 77 | }; | 81 | }; |
| 78 | 82 | ||
| 79 | // A class representing a file in an abstract filesystem. | 83 | // A class representing a file in an abstract filesystem. |
| 80 | class VfsFile : NonCopyable { | 84 | class VfsFile { |
| 81 | public: | 85 | public: |
| 86 | YUZU_NON_COPYABLE(VfsFile); | ||
| 87 | YUZU_NON_MOVEABLE(VfsFile); | ||
| 88 | |||
| 89 | VfsFile() = default; | ||
| 82 | virtual ~VfsFile(); | 90 | virtual ~VfsFile(); |
| 83 | 91 | ||
| 84 | // Retrieves the file name. | 92 | // Retrieves the file name. |
| @@ -176,8 +184,12 @@ public: | |||
| 176 | }; | 184 | }; |
| 177 | 185 | ||
| 178 | // A class representing a directory in an abstract filesystem. | 186 | // A class representing a directory in an abstract filesystem. |
| 179 | class VfsDirectory : NonCopyable { | 187 | class VfsDirectory { |
| 180 | public: | 188 | public: |
| 189 | YUZU_NON_COPYABLE(VfsDirectory); | ||
| 190 | YUZU_NON_MOVEABLE(VfsDirectory); | ||
| 191 | |||
| 192 | VfsDirectory() = default; | ||
| 181 | virtual ~VfsDirectory(); | 193 | virtual ~VfsDirectory(); |
| 182 | 194 | ||
| 183 | // Retrives the file located at path as if the current directory was root. Returns nullptr if | 195 | // Retrives the file located at path as if the current directory was root. Returns nullptr if |
diff --git a/src/core/hid/emulated_console.h b/src/core/hid/emulated_console.h index 707419102..5eb170823 100644 --- a/src/core/hid/emulated_console.h +++ b/src/core/hid/emulated_console.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <mutex> | 10 | #include <mutex> |
| 11 | #include <unordered_map> | 11 | #include <unordered_map> |
| 12 | 12 | ||
| 13 | #include "common/common_funcs.h" | ||
| 13 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 14 | #include "common/input.h" | 15 | #include "common/input.h" |
| 15 | #include "common/param_package.h" | 16 | #include "common/param_package.h" |
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index a63a83cce..d8642c5b3 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h | |||
| @@ -13,8 +13,6 @@ | |||
| 13 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 14 | #include "common/input.h" | 14 | #include "common/input.h" |
| 15 | #include "common/param_package.h" | 15 | #include "common/param_package.h" |
| 16 | #include "common/point.h" | ||
| 17 | #include "common/quaternion.h" | ||
| 18 | #include "common/settings.h" | 16 | #include "common/settings.h" |
| 19 | #include "common/vector_math.h" | 17 | #include "common/vector_math.h" |
| 20 | #include "core/hid/hid_types.h" | 18 | #include "core/hid/hid_types.h" |
diff --git a/src/core/hid/hid_core.h b/src/core/hid/hid_core.h index 837f7de49..717f605e7 100644 --- a/src/core/hid/hid_core.h +++ b/src/core/hid/hid_core.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | 8 | ||
| 9 | #include "common/common_funcs.h" | ||
| 9 | #include "core/hid/hid_types.h" | 10 | #include "core/hid/hid_types.h" |
| 10 | 11 | ||
| 11 | namespace Core::HID { | 12 | namespace Core::HID { |
diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h index 165b76747..05779f2d5 100644 --- a/src/core/hle/kernel/k_auto_object.h +++ b/src/core/hle/kernel/k_auto_object.h | |||
| @@ -20,8 +20,6 @@ class KernelCore; | |||
| 20 | class KProcess; | 20 | class KProcess; |
| 21 | 21 | ||
| 22 | #define KERNEL_AUTOOBJECT_TRAITS(CLASS, BASE_CLASS) \ | 22 | #define KERNEL_AUTOOBJECT_TRAITS(CLASS, BASE_CLASS) \ |
| 23 | YUZU_NON_COPYABLE(CLASS); \ | ||
| 24 | YUZU_NON_MOVEABLE(CLASS); \ | ||
| 25 | \ | 23 | \ |
| 26 | private: \ | 24 | private: \ |
| 27 | friend class ::Kernel::KClassTokenGenerator; \ | 25 | friend class ::Kernel::KClassTokenGenerator; \ |
| @@ -32,6 +30,9 @@ private: | |||
| 32 | } \ | 30 | } \ |
| 33 | \ | 31 | \ |
| 34 | public: \ | 32 | public: \ |
| 33 | YUZU_NON_COPYABLE(CLASS); \ | ||
| 34 | YUZU_NON_MOVEABLE(CLASS); \ | ||
| 35 | \ | ||
| 35 | using BaseClass = BASE_CLASS; \ | 36 | using BaseClass = BASE_CLASS; \ |
| 36 | static constexpr TypeObj GetStaticTypeObj() { \ | 37 | static constexpr TypeObj GetStaticTypeObj() { \ |
| 37 | constexpr ClassTokenType Token = ClassToken(); \ | 38 | constexpr ClassTokenType Token = ClassToken(); \ |
| @@ -224,9 +225,9 @@ private: | |||
| 224 | 225 | ||
| 225 | template <typename T> | 226 | template <typename T> |
| 226 | class KScopedAutoObject { | 227 | class KScopedAutoObject { |
| 228 | public: | ||
| 227 | YUZU_NON_COPYABLE(KScopedAutoObject); | 229 | YUZU_NON_COPYABLE(KScopedAutoObject); |
| 228 | 230 | ||
| 229 | public: | ||
| 230 | constexpr KScopedAutoObject() = default; | 231 | constexpr KScopedAutoObject() = default; |
| 231 | 232 | ||
| 232 | constexpr KScopedAutoObject(T* o) : m_obj(o) { | 233 | constexpr KScopedAutoObject(T* o) : m_obj(o) { |
diff --git a/src/core/hle/kernel/k_auto_object_container.h b/src/core/hle/kernel/k_auto_object_container.h index 4eadfe99d..697cc4289 100644 --- a/src/core/hle/kernel/k_auto_object_container.h +++ b/src/core/hle/kernel/k_auto_object_container.h | |||
| @@ -16,13 +16,12 @@ class KernelCore; | |||
| 16 | class KProcess; | 16 | class KProcess; |
| 17 | 17 | ||
| 18 | class KAutoObjectWithListContainer { | 18 | class KAutoObjectWithListContainer { |
| 19 | public: | ||
| 19 | YUZU_NON_COPYABLE(KAutoObjectWithListContainer); | 20 | YUZU_NON_COPYABLE(KAutoObjectWithListContainer); |
| 20 | YUZU_NON_MOVEABLE(KAutoObjectWithListContainer); | 21 | YUZU_NON_MOVEABLE(KAutoObjectWithListContainer); |
| 21 | 22 | ||
| 22 | public: | ||
| 23 | using ListType = boost::intrusive::rbtree<KAutoObjectWithList>; | 23 | using ListType = boost::intrusive::rbtree<KAutoObjectWithList>; |
| 24 | 24 | ||
| 25 | public: | ||
| 26 | class ListAccessor : public KScopedLightLock { | 25 | class ListAccessor : public KScopedLightLock { |
| 27 | public: | 26 | public: |
| 28 | explicit ListAccessor(KAutoObjectWithListContainer* container) | 27 | explicit ListAccessor(KAutoObjectWithListContainer* container) |
| @@ -48,7 +47,6 @@ public: | |||
| 48 | 47 | ||
| 49 | friend class ListAccessor; | 48 | friend class ListAccessor; |
| 50 | 49 | ||
| 51 | public: | ||
| 52 | KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(kernel), m_object_list() {} | 50 | KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(kernel), m_object_list() {} |
| 53 | 51 | ||
| 54 | void Initialize() {} | 52 | void Initialize() {} |
diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h index 4b114ec2f..87004a0f9 100644 --- a/src/core/hle/kernel/k_handle_table.h +++ b/src/core/hle/kernel/k_handle_table.h | |||
| @@ -22,13 +22,12 @@ namespace Kernel { | |||
| 22 | class KernelCore; | 22 | class KernelCore; |
| 23 | 23 | ||
| 24 | class KHandleTable { | 24 | class KHandleTable { |
| 25 | public: | ||
| 25 | YUZU_NON_COPYABLE(KHandleTable); | 26 | YUZU_NON_COPYABLE(KHandleTable); |
| 26 | YUZU_NON_MOVEABLE(KHandleTable); | 27 | YUZU_NON_MOVEABLE(KHandleTable); |
| 27 | 28 | ||
| 28 | public: | ||
| 29 | static constexpr size_t MaxTableSize = 1024; | 29 | static constexpr size_t MaxTableSize = 1024; |
| 30 | 30 | ||
| 31 | public: | ||
| 32 | explicit KHandleTable(KernelCore& kernel_); | 31 | explicit KHandleTable(KernelCore& kernel_); |
| 33 | ~KHandleTable(); | 32 | ~KHandleTable(); |
| 34 | 33 | ||
diff --git a/src/core/hle/kernel/k_memory_manager.h b/src/core/hle/kernel/k_memory_manager.h index abd6c8ace..17c7690f1 100644 --- a/src/core/hle/kernel/k_memory_manager.h +++ b/src/core/hle/kernel/k_memory_manager.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <mutex> | 8 | #include <mutex> |
| 9 | #include <tuple> | 9 | #include <tuple> |
| 10 | 10 | ||
| 11 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/k_page_heap.h" | 13 | #include "core/hle/kernel/k_page_heap.h" |
| 13 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| @@ -20,8 +21,11 @@ namespace Kernel { | |||
| 20 | 21 | ||
| 21 | class KPageLinkedList; | 22 | class KPageLinkedList; |
| 22 | 23 | ||
| 23 | class KMemoryManager final : NonCopyable { | 24 | class KMemoryManager final { |
| 24 | public: | 25 | public: |
| 26 | YUZU_NON_COPYABLE(KMemoryManager); | ||
| 27 | YUZU_NON_MOVEABLE(KMemoryManager); | ||
| 28 | |||
| 25 | enum class Pool : u32 { | 29 | enum class Pool : u32 { |
| 26 | Application = 0, | 30 | Application = 0, |
| 27 | Applet = 1, | 31 | Applet = 1, |
| @@ -88,26 +92,13 @@ public: | |||
| 88 | } | 92 | } |
| 89 | 93 | ||
| 90 | private: | 94 | private: |
| 91 | class Impl final : NonCopyable { | 95 | class Impl final { |
| 92 | private: | ||
| 93 | using RefCount = u16; | ||
| 94 | |||
| 95 | private: | ||
| 96 | KPageHeap heap; | ||
| 97 | Pool pool{}; | ||
| 98 | |||
| 99 | public: | 96 | public: |
| 100 | static std::size_t CalculateManagementOverheadSize(std::size_t region_size); | 97 | YUZU_NON_COPYABLE(Impl); |
| 101 | 98 | YUZU_NON_MOVEABLE(Impl); | |
| 102 | static constexpr std::size_t CalculateOptimizedProcessOverheadSize( | ||
| 103 | std::size_t region_size) { | ||
| 104 | return (Common::AlignUp((region_size / PageSize), Common::BitSize<u64>()) / | ||
| 105 | Common::BitSize<u64>()) * | ||
| 106 | sizeof(u64); | ||
| 107 | } | ||
| 108 | 99 | ||
| 109 | public: | ||
| 110 | Impl() = default; | 100 | Impl() = default; |
| 101 | ~Impl() = default; | ||
| 111 | 102 | ||
| 112 | std::size_t Initialize(Pool new_pool, u64 start_address, u64 end_address); | 103 | std::size_t Initialize(Pool new_pool, u64 start_address, u64 end_address); |
| 113 | 104 | ||
| @@ -130,6 +121,21 @@ private: | |||
| 130 | constexpr VAddr GetEndAddress() const { | 121 | constexpr VAddr GetEndAddress() const { |
| 131 | return heap.GetEndAddress(); | 122 | return heap.GetEndAddress(); |
| 132 | } | 123 | } |
| 124 | |||
| 125 | static std::size_t CalculateManagementOverheadSize(std::size_t region_size); | ||
| 126 | |||
| 127 | static constexpr std::size_t CalculateOptimizedProcessOverheadSize( | ||
| 128 | std::size_t region_size) { | ||
| 129 | return (Common::AlignUp((region_size / PageSize), Common::BitSize<u64>()) / | ||
| 130 | Common::BitSize<u64>()) * | ||
| 131 | sizeof(u64); | ||
| 132 | } | ||
| 133 | |||
| 134 | private: | ||
| 135 | using RefCount = u16; | ||
| 136 | |||
| 137 | KPageHeap heap; | ||
| 138 | Pool pool{}; | ||
| 133 | }; | 139 | }; |
| 134 | 140 | ||
| 135 | private: | 141 | private: |
diff --git a/src/core/hle/kernel/k_memory_region.h b/src/core/hle/kernel/k_memory_region.h index 90ab8fd62..e9bdf4e59 100644 --- a/src/core/hle/kernel/k_memory_region.h +++ b/src/core/hle/kernel/k_memory_region.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/common_funcs.h" | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "common/intrusive_red_black_tree.h" | 10 | #include "common/intrusive_red_black_tree.h" |
| 10 | #include "core/hle/kernel/k_memory_region_type.h" | 11 | #include "core/hle/kernel/k_memory_region_type.h" |
| @@ -13,11 +14,13 @@ namespace Kernel { | |||
| 13 | 14 | ||
| 14 | class KMemoryRegionAllocator; | 15 | class KMemoryRegionAllocator; |
| 15 | 16 | ||
| 16 | class KMemoryRegion final : public Common::IntrusiveRedBlackTreeBaseNode<KMemoryRegion>, | 17 | class KMemoryRegion final : public Common::IntrusiveRedBlackTreeBaseNode<KMemoryRegion> { |
| 17 | NonCopyable { | ||
| 18 | friend class KMemoryRegionTree; | 18 | friend class KMemoryRegionTree; |
| 19 | 19 | ||
| 20 | public: | 20 | public: |
| 21 | YUZU_NON_COPYABLE(KMemoryRegion); | ||
| 22 | YUZU_NON_MOVEABLE(KMemoryRegion); | ||
| 23 | |||
| 21 | constexpr KMemoryRegion() = default; | 24 | constexpr KMemoryRegion() = default; |
| 22 | constexpr KMemoryRegion(u64 address_, u64 last_address_) | 25 | constexpr KMemoryRegion(u64 address_, u64 last_address_) |
| 23 | : address{address_}, last_address{last_address_} {} | 26 | : address{address_}, last_address{last_address_} {} |
| @@ -29,6 +32,8 @@ public: | |||
| 29 | : KMemoryRegion(address_, last_address_, std::numeric_limits<u64>::max(), attributes_, | 32 | : KMemoryRegion(address_, last_address_, std::numeric_limits<u64>::max(), attributes_, |
| 30 | type_id_) {} | 33 | type_id_) {} |
| 31 | 34 | ||
| 35 | ~KMemoryRegion() = default; | ||
| 36 | |||
| 32 | static constexpr int Compare(const KMemoryRegion& lhs, const KMemoryRegion& rhs) { | 37 | static constexpr int Compare(const KMemoryRegion& lhs, const KMemoryRegion& rhs) { |
| 33 | if (lhs.GetAddress() < rhs.GetAddress()) { | 38 | if (lhs.GetAddress() < rhs.GetAddress()) { |
| 34 | return -1; | 39 | return -1; |
| @@ -39,16 +44,6 @@ public: | |||
| 39 | } | 44 | } |
| 40 | } | 45 | } |
| 41 | 46 | ||
| 42 | private: | ||
| 43 | constexpr void Reset(u64 a, u64 la, u64 p, u32 r, u32 t) { | ||
| 44 | address = a; | ||
| 45 | pair_address = p; | ||
| 46 | last_address = la; | ||
| 47 | attributes = r; | ||
| 48 | type_id = t; | ||
| 49 | } | ||
| 50 | |||
| 51 | public: | ||
| 52 | constexpr u64 GetAddress() const { | 47 | constexpr u64 GetAddress() const { |
| 53 | return address; | 48 | return address; |
| 54 | } | 49 | } |
| @@ -108,6 +103,14 @@ public: | |||
| 108 | } | 103 | } |
| 109 | 104 | ||
| 110 | private: | 105 | private: |
| 106 | constexpr void Reset(u64 a, u64 la, u64 p, u32 r, u32 t) { | ||
| 107 | address = a; | ||
| 108 | pair_address = p; | ||
| 109 | last_address = la; | ||
| 110 | attributes = r; | ||
| 111 | type_id = t; | ||
| 112 | } | ||
| 113 | |||
| 111 | u64 address{}; | 114 | u64 address{}; |
| 112 | u64 last_address{}; | 115 | u64 last_address{}; |
| 113 | u64 pair_address{}; | 116 | u64 pair_address{}; |
| @@ -115,8 +118,25 @@ private: | |||
| 115 | u32 type_id{}; | 118 | u32 type_id{}; |
| 116 | }; | 119 | }; |
| 117 | 120 | ||
| 118 | class KMemoryRegionTree final : NonCopyable { | 121 | class KMemoryRegionTree final { |
| 122 | private: | ||
| 123 | using TreeType = | ||
| 124 | Common::IntrusiveRedBlackTreeBaseTraits<KMemoryRegion>::TreeType<KMemoryRegion>; | ||
| 125 | |||
| 119 | public: | 126 | public: |
| 127 | YUZU_NON_COPYABLE(KMemoryRegionTree); | ||
| 128 | YUZU_NON_MOVEABLE(KMemoryRegionTree); | ||
| 129 | |||
| 130 | using value_type = TreeType::value_type; | ||
| 131 | using size_type = TreeType::size_type; | ||
| 132 | using difference_type = TreeType::difference_type; | ||
| 133 | using pointer = TreeType::pointer; | ||
| 134 | using const_pointer = TreeType::const_pointer; | ||
| 135 | using reference = TreeType::reference; | ||
| 136 | using const_reference = TreeType::const_reference; | ||
| 137 | using iterator = TreeType::iterator; | ||
| 138 | using const_iterator = TreeType::const_iterator; | ||
| 139 | |||
| 120 | struct DerivedRegionExtents { | 140 | struct DerivedRegionExtents { |
| 121 | const KMemoryRegion* first_region{}; | 141 | const KMemoryRegion* first_region{}; |
| 122 | const KMemoryRegion* last_region{}; | 142 | const KMemoryRegion* last_region{}; |
| @@ -140,29 +160,9 @@ public: | |||
| 140 | } | 160 | } |
| 141 | }; | 161 | }; |
| 142 | 162 | ||
| 143 | private: | ||
| 144 | using TreeType = | ||
| 145 | Common::IntrusiveRedBlackTreeBaseTraits<KMemoryRegion>::TreeType<KMemoryRegion>; | ||
| 146 | |||
| 147 | public: | ||
| 148 | using value_type = TreeType::value_type; | ||
| 149 | using size_type = TreeType::size_type; | ||
| 150 | using difference_type = TreeType::difference_type; | ||
| 151 | using pointer = TreeType::pointer; | ||
| 152 | using const_pointer = TreeType::const_pointer; | ||
| 153 | using reference = TreeType::reference; | ||
| 154 | using const_reference = TreeType::const_reference; | ||
| 155 | using iterator = TreeType::iterator; | ||
| 156 | using const_iterator = TreeType::const_iterator; | ||
| 157 | |||
| 158 | private: | ||
| 159 | TreeType m_tree{}; | ||
| 160 | KMemoryRegionAllocator& memory_region_allocator; | ||
| 161 | |||
| 162 | public: | ||
| 163 | explicit KMemoryRegionTree(KMemoryRegionAllocator& memory_region_allocator_); | 163 | explicit KMemoryRegionTree(KMemoryRegionAllocator& memory_region_allocator_); |
| 164 | ~KMemoryRegionTree() = default; | ||
| 164 | 165 | ||
| 165 | public: | ||
| 166 | KMemoryRegion* FindModifiable(u64 address) { | 166 | KMemoryRegion* FindModifiable(u64 address) { |
| 167 | if (auto it = this->find(KMemoryRegion(address, address, 0, 0)); it != this->end()) { | 167 | if (auto it = this->find(KMemoryRegion(address, address, 0, 0)); it != this->end()) { |
| 168 | return std::addressof(*it); | 168 | return std::addressof(*it); |
| @@ -241,7 +241,6 @@ public: | |||
| 241 | return GetDerivedRegionExtents(static_cast<KMemoryRegionType>(type_id)); | 241 | return GetDerivedRegionExtents(static_cast<KMemoryRegionType>(type_id)); |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | public: | ||
| 245 | void InsertDirectly(u64 address, u64 last_address, u32 attr = 0, u32 type_id = 0); | 244 | void InsertDirectly(u64 address, u64 last_address, u32 attr = 0, u32 type_id = 0); |
| 246 | bool Insert(u64 address, size_t size, u32 type_id, u32 new_attr = 0, u32 old_attr = 0); | 245 | bool Insert(u64 address, size_t size, u32 type_id, u32 new_attr = 0, u32 old_attr = 0); |
| 247 | 246 | ||
| @@ -252,7 +251,6 @@ public: | |||
| 252 | return this->GetRandomAlignedRegion(size + 2 * guard_size, alignment, type_id) + guard_size; | 251 | return this->GetRandomAlignedRegion(size + 2 * guard_size, alignment, type_id) + guard_size; |
| 253 | } | 252 | } |
| 254 | 253 | ||
| 255 | public: | ||
| 256 | // Iterator accessors. | 254 | // Iterator accessors. |
| 257 | iterator begin() { | 255 | iterator begin() { |
| 258 | return m_tree.begin(); | 256 | return m_tree.begin(); |
| @@ -322,13 +320,21 @@ public: | |||
| 322 | iterator nfind(const_reference ref) const { | 320 | iterator nfind(const_reference ref) const { |
| 323 | return m_tree.nfind(ref); | 321 | return m_tree.nfind(ref); |
| 324 | } | 322 | } |
| 323 | |||
| 324 | private: | ||
| 325 | TreeType m_tree{}; | ||
| 326 | KMemoryRegionAllocator& memory_region_allocator; | ||
| 325 | }; | 327 | }; |
| 326 | 328 | ||
| 327 | class KMemoryRegionAllocator final : NonCopyable { | 329 | class KMemoryRegionAllocator final { |
| 328 | public: | 330 | public: |
| 331 | YUZU_NON_COPYABLE(KMemoryRegionAllocator); | ||
| 332 | YUZU_NON_MOVEABLE(KMemoryRegionAllocator); | ||
| 333 | |||
| 329 | static constexpr size_t MaxMemoryRegions = 200; | 334 | static constexpr size_t MaxMemoryRegions = 200; |
| 330 | 335 | ||
| 331 | constexpr KMemoryRegionAllocator() = default; | 336 | constexpr KMemoryRegionAllocator() = default; |
| 337 | constexpr ~KMemoryRegionAllocator() = default; | ||
| 332 | 338 | ||
| 333 | template <typename... Args> | 339 | template <typename... Args> |
| 334 | KMemoryRegion* Allocate(Args&&... args) { | 340 | KMemoryRegion* Allocate(Args&&... args) { |
diff --git a/src/core/hle/kernel/k_page_heap.h b/src/core/hle/kernel/k_page_heap.h index 8d9f30523..a65aa28a0 100644 --- a/src/core/hle/kernel/k_page_heap.h +++ b/src/core/hle/kernel/k_page_heap.h | |||
| @@ -8,14 +8,44 @@ | |||
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | 9 | ||
| 10 | #include "common/alignment.h" | 10 | #include "common/alignment.h" |
| 11 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/k_page_bitmap.h" | 13 | #include "core/hle/kernel/k_page_bitmap.h" |
| 13 | #include "core/hle/kernel/memory_types.h" | 14 | #include "core/hle/kernel/memory_types.h" |
| 14 | 15 | ||
| 15 | namespace Kernel { | 16 | namespace Kernel { |
| 16 | 17 | ||
| 17 | class KPageHeap final : NonCopyable { | 18 | class KPageHeap final { |
| 18 | public: | 19 | public: |
| 20 | YUZU_NON_COPYABLE(KPageHeap); | ||
| 21 | YUZU_NON_MOVEABLE(KPageHeap); | ||
| 22 | |||
| 23 | KPageHeap() = default; | ||
| 24 | ~KPageHeap() = default; | ||
| 25 | |||
| 26 | constexpr VAddr GetAddress() const { | ||
| 27 | return heap_address; | ||
| 28 | } | ||
| 29 | constexpr std::size_t GetSize() const { | ||
| 30 | return heap_size; | ||
| 31 | } | ||
| 32 | constexpr VAddr GetEndAddress() const { | ||
| 33 | return GetAddress() + GetSize(); | ||
| 34 | } | ||
| 35 | constexpr std::size_t GetPageOffset(VAddr block) const { | ||
| 36 | return (block - GetAddress()) / PageSize; | ||
| 37 | } | ||
| 38 | |||
| 39 | void Initialize(VAddr heap_address, std::size_t heap_size, std::size_t metadata_size); | ||
| 40 | VAddr AllocateBlock(s32 index, bool random); | ||
| 41 | void Free(VAddr addr, std::size_t num_pages); | ||
| 42 | |||
| 43 | void UpdateUsedSize() { | ||
| 44 | used_size = heap_size - (GetNumFreePages() * PageSize); | ||
| 45 | } | ||
| 46 | |||
| 47 | static std::size_t CalculateManagementOverheadSize(std::size_t region_size); | ||
| 48 | |||
| 19 | static constexpr s32 GetAlignedBlockIndex(std::size_t num_pages, std::size_t align_pages) { | 49 | static constexpr s32 GetAlignedBlockIndex(std::size_t num_pages, std::size_t align_pages) { |
| 20 | const auto target_pages{std::max(num_pages, align_pages)}; | 50 | const auto target_pages{std::max(num_pages, align_pages)}; |
| 21 | for (std::size_t i = 0; i < NumMemoryBlockPageShifts; i++) { | 51 | for (std::size_t i = 0; i < NumMemoryBlockPageShifts; i++) { |
| @@ -45,21 +75,13 @@ public: | |||
| 45 | } | 75 | } |
| 46 | 76 | ||
| 47 | private: | 77 | private: |
| 48 | static constexpr std::size_t NumMemoryBlockPageShifts{7}; | 78 | class Block final { |
| 49 | static constexpr std::array<std::size_t, NumMemoryBlockPageShifts> MemoryBlockPageShifts{ | ||
| 50 | 0xC, 0x10, 0x15, 0x16, 0x19, 0x1D, 0x1E, | ||
| 51 | }; | ||
| 52 | |||
| 53 | class Block final : NonCopyable { | ||
| 54 | private: | ||
| 55 | KPageBitmap bitmap; | ||
| 56 | VAddr heap_address{}; | ||
| 57 | uintptr_t end_offset{}; | ||
| 58 | std::size_t block_shift{}; | ||
| 59 | std::size_t next_block_shift{}; | ||
| 60 | |||
| 61 | public: | 79 | public: |
| 80 | YUZU_NON_COPYABLE(Block); | ||
| 81 | YUZU_NON_MOVEABLE(Block); | ||
| 82 | |||
| 62 | Block() = default; | 83 | Block() = default; |
| 84 | ~Block() = default; | ||
| 63 | 85 | ||
| 64 | constexpr std::size_t GetShift() const { | 86 | constexpr std::size_t GetShift() const { |
| 65 | return block_shift; | 87 | return block_shift; |
| @@ -129,7 +151,6 @@ private: | |||
| 129 | return heap_address + (offset << GetShift()); | 151 | return heap_address + (offset << GetShift()); |
| 130 | } | 152 | } |
| 131 | 153 | ||
| 132 | public: | ||
| 133 | static constexpr std::size_t CalculateManagementOverheadSize(std::size_t region_size, | 154 | static constexpr std::size_t CalculateManagementOverheadSize(std::size_t region_size, |
| 134 | std::size_t cur_block_shift, | 155 | std::size_t cur_block_shift, |
| 135 | std::size_t next_block_shift) { | 156 | std::size_t next_block_shift) { |
| @@ -139,35 +160,15 @@ private: | |||
| 139 | return KPageBitmap::CalculateManagementOverheadSize( | 160 | return KPageBitmap::CalculateManagementOverheadSize( |
| 140 | (align * 2 + Common::AlignUp(region_size, align)) / cur_block_size); | 161 | (align * 2 + Common::AlignUp(region_size, align)) / cur_block_size); |
| 141 | } | 162 | } |
| 142 | }; | ||
| 143 | |||
| 144 | public: | ||
| 145 | KPageHeap() = default; | ||
| 146 | |||
| 147 | constexpr VAddr GetAddress() const { | ||
| 148 | return heap_address; | ||
| 149 | } | ||
| 150 | constexpr std::size_t GetSize() const { | ||
| 151 | return heap_size; | ||
| 152 | } | ||
| 153 | constexpr VAddr GetEndAddress() const { | ||
| 154 | return GetAddress() + GetSize(); | ||
| 155 | } | ||
| 156 | constexpr std::size_t GetPageOffset(VAddr block) const { | ||
| 157 | return (block - GetAddress()) / PageSize; | ||
| 158 | } | ||
| 159 | 163 | ||
| 160 | void Initialize(VAddr heap_address, std::size_t heap_size, std::size_t metadata_size); | 164 | private: |
| 161 | VAddr AllocateBlock(s32 index, bool random); | 165 | KPageBitmap bitmap; |
| 162 | void Free(VAddr addr, std::size_t num_pages); | 166 | VAddr heap_address{}; |
| 163 | 167 | uintptr_t end_offset{}; | |
| 164 | void UpdateUsedSize() { | 168 | std::size_t block_shift{}; |
| 165 | used_size = heap_size - (GetNumFreePages() * PageSize); | 169 | std::size_t next_block_shift{}; |
| 166 | } | 170 | }; |
| 167 | |||
| 168 | static std::size_t CalculateManagementOverheadSize(std::size_t region_size); | ||
| 169 | 171 | ||
| 170 | private: | ||
| 171 | constexpr std::size_t GetNumFreePages() const { | 172 | constexpr std::size_t GetNumFreePages() const { |
| 172 | std::size_t num_free{}; | 173 | std::size_t num_free{}; |
| 173 | 174 | ||
| @@ -180,6 +181,11 @@ private: | |||
| 180 | 181 | ||
| 181 | void FreeBlock(VAddr block, s32 index); | 182 | void FreeBlock(VAddr block, s32 index); |
| 182 | 183 | ||
| 184 | static constexpr std::size_t NumMemoryBlockPageShifts{7}; | ||
| 185 | static constexpr std::array<std::size_t, NumMemoryBlockPageShifts> MemoryBlockPageShifts{ | ||
| 186 | 0xC, 0x10, 0x15, 0x16, 0x19, 0x1D, 0x1E, | ||
| 187 | }; | ||
| 188 | |||
| 183 | VAddr heap_address{}; | 189 | VAddr heap_address{}; |
| 184 | std::size_t heap_size{}; | 190 | std::size_t heap_size{}; |
| 185 | std::size_t used_size{}; | 191 | std::size_t used_size{}; |
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index 2ebbc0819..393214082 100644 --- a/src/core/hle/kernel/k_page_table.cpp +++ b/src/core/hle/kernel/k_page_table.cpp | |||
| @@ -63,6 +63,8 @@ constexpr std::size_t GetSizeInRange(const KMemoryInfo& info, VAddr start, VAddr | |||
| 63 | 63 | ||
| 64 | KPageTable::KPageTable(Core::System& system_) : system{system_} {} | 64 | KPageTable::KPageTable(Core::System& system_) : system{system_} {} |
| 65 | 65 | ||
| 66 | KPageTable::~KPageTable() = default; | ||
| 67 | |||
| 66 | ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, | 68 | ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, |
| 67 | bool enable_aslr, VAddr code_addr, | 69 | bool enable_aslr, VAddr code_addr, |
| 68 | std::size_t code_size, KMemoryManager::Pool pool) { | 70 | std::size_t code_size, KMemoryManager::Pool pool) { |
diff --git a/src/core/hle/kernel/k_page_table.h b/src/core/hle/kernel/k_page_table.h index 60ae9b9e8..ecae939a0 100644 --- a/src/core/hle/kernel/k_page_table.h +++ b/src/core/hle/kernel/k_page_table.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <mutex> | 8 | #include <mutex> |
| 9 | 9 | ||
| 10 | #include "common/common_funcs.h" | ||
| 10 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 11 | #include "common/page_table.h" | 12 | #include "common/page_table.h" |
| 12 | #include "core/file_sys/program_metadata.h" | 13 | #include "core/file_sys/program_metadata.h" |
| @@ -22,9 +23,13 @@ namespace Kernel { | |||
| 22 | 23 | ||
| 23 | class KMemoryBlockManager; | 24 | class KMemoryBlockManager; |
| 24 | 25 | ||
| 25 | class KPageTable final : NonCopyable { | 26 | class KPageTable final { |
| 26 | public: | 27 | public: |
| 28 | YUZU_NON_COPYABLE(KPageTable); | ||
| 29 | YUZU_NON_MOVEABLE(KPageTable); | ||
| 30 | |||
| 27 | explicit KPageTable(Core::System& system_); | 31 | explicit KPageTable(Core::System& system_); |
| 32 | ~KPageTable(); | ||
| 28 | 33 | ||
| 29 | ResultCode InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, bool enable_aslr, | 34 | ResultCode InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, bool enable_aslr, |
| 30 | VAddr code_addr, std::size_t code_size, | 35 | VAddr code_addr, std::size_t code_size, |
diff --git a/src/core/hle/kernel/k_slab_heap.h b/src/core/hle/kernel/k_slab_heap.h index 0ad74b0a0..05c0bec9c 100644 --- a/src/core/hle/kernel/k_slab_heap.h +++ b/src/core/hle/kernel/k_slab_heap.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <atomic> | 7 | #include <atomic> |
| 8 | 8 | ||
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/common_funcs.h" | ||
| 10 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 11 | 12 | ||
| 12 | namespace Kernel { | 13 | namespace Kernel { |
| @@ -15,13 +16,17 @@ class KernelCore; | |||
| 15 | 16 | ||
| 16 | namespace impl { | 17 | namespace impl { |
| 17 | 18 | ||
| 18 | class KSlabHeapImpl final : NonCopyable { | 19 | class KSlabHeapImpl final { |
| 19 | public: | 20 | public: |
| 21 | YUZU_NON_COPYABLE(KSlabHeapImpl); | ||
| 22 | YUZU_NON_MOVEABLE(KSlabHeapImpl); | ||
| 23 | |||
| 20 | struct Node { | 24 | struct Node { |
| 21 | Node* next{}; | 25 | Node* next{}; |
| 22 | }; | 26 | }; |
| 23 | 27 | ||
| 24 | constexpr KSlabHeapImpl() = default; | 28 | constexpr KSlabHeapImpl() = default; |
| 29 | constexpr ~KSlabHeapImpl() = default; | ||
| 25 | 30 | ||
| 26 | void Initialize(std::size_t size) { | 31 | void Initialize(std::size_t size) { |
| 27 | ASSERT(head == nullptr); | 32 | ASSERT(head == nullptr); |
| @@ -64,9 +69,13 @@ private: | |||
| 64 | 69 | ||
| 65 | } // namespace impl | 70 | } // namespace impl |
| 66 | 71 | ||
| 67 | class KSlabHeapBase : NonCopyable { | 72 | class KSlabHeapBase { |
| 68 | public: | 73 | public: |
| 74 | YUZU_NON_COPYABLE(KSlabHeapBase); | ||
| 75 | YUZU_NON_MOVEABLE(KSlabHeapBase); | ||
| 76 | |||
| 69 | constexpr KSlabHeapBase() = default; | 77 | constexpr KSlabHeapBase() = default; |
| 78 | constexpr ~KSlabHeapBase() = default; | ||
| 70 | 79 | ||
| 71 | constexpr bool Contains(uintptr_t addr) const { | 80 | constexpr bool Contains(uintptr_t addr) const { |
| 72 | return start <= addr && addr < end; | 81 | return start <= addr && addr < end; |
diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h index 0979fc421..329f4ba86 100644 --- a/src/core/hle/service/vi/display/vi_display.h +++ b/src/core/hle/service/vi/display/vi_display.h | |||
| @@ -28,10 +28,10 @@ class Layer; | |||
| 28 | 28 | ||
| 29 | /// Represents a single display type | 29 | /// Represents a single display type |
| 30 | class Display { | 30 | class Display { |
| 31 | public: | ||
| 31 | YUZU_NON_COPYABLE(Display); | 32 | YUZU_NON_COPYABLE(Display); |
| 32 | YUZU_NON_MOVEABLE(Display); | 33 | YUZU_NON_MOVEABLE(Display); |
| 33 | 34 | ||
| 34 | public: | ||
| 35 | /// Constructs a display with a given unique ID and name. | 35 | /// Constructs a display with a given unique ID and name. |
| 36 | /// | 36 | /// |
| 37 | /// @param id The unique ID for this display. | 37 | /// @param id The unique ID for this display. |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 7b1bac3f7..8b6b3b68f 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <utility> | 11 | #include <utility> |
| 12 | #include <vector> | 12 | #include <vector> |
| 13 | 13 | ||
| 14 | #include "common/common_funcs.h" | ||
| 14 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 15 | #include "core/file_sys/control_metadata.h" | 16 | #include "core/file_sys/control_metadata.h" |
| 16 | #include "core/file_sys/vfs.h" | 17 | #include "core/file_sys/vfs.h" |
| @@ -139,8 +140,11 @@ std::string GetResultStatusString(ResultStatus status); | |||
| 139 | std::ostream& operator<<(std::ostream& os, ResultStatus status); | 140 | std::ostream& operator<<(std::ostream& os, ResultStatus status); |
| 140 | 141 | ||
| 141 | /// Interface for loading an application | 142 | /// Interface for loading an application |
| 142 | class AppLoader : NonCopyable { | 143 | class AppLoader { |
| 143 | public: | 144 | public: |
| 145 | YUZU_NON_COPYABLE(AppLoader); | ||
| 146 | YUZU_NON_MOVEABLE(AppLoader); | ||
| 147 | |||
| 144 | struct LoadParameters { | 148 | struct LoadParameters { |
| 145 | s32 main_thread_priority; | 149 | s32 main_thread_priority; |
| 146 | u64 main_thread_stack_size; | 150 | u64 main_thread_stack_size; |
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index bb204454e..c5f974080 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h | |||
| @@ -5,9 +5,10 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <atomic> | 7 | #include <atomic> |
| 8 | #include <functional> | ||
| 8 | #include <memory> | 9 | #include <memory> |
| 9 | #include <optional> | ||
| 10 | 10 | ||
| 11 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 12 | #include "core/frontend/emu_window.h" | 13 | #include "core/frontend/emu_window.h" |
| 13 | #include "video_core/gpu.h" | 14 | #include "video_core/gpu.h" |
| @@ -28,8 +29,11 @@ struct RendererSettings { | |||
| 28 | Layout::FramebufferLayout screenshot_framebuffer_layout; | 29 | Layout::FramebufferLayout screenshot_framebuffer_layout; |
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | class RendererBase : NonCopyable { | 32 | class RendererBase { |
| 32 | public: | 33 | public: |
| 34 | YUZU_NON_COPYABLE(RendererBase); | ||
| 35 | YUZU_NON_MOVEABLE(RendererBase); | ||
| 36 | |||
| 33 | explicit RendererBase(Core::Frontend::EmuWindow& window, | 37 | explicit RendererBase(Core::Frontend::EmuWindow& window, |
| 34 | std::unique_ptr<Core::Frontend::GraphicsContext> context); | 38 | std::unique_ptr<Core::Frontend::GraphicsContext> context); |
| 35 | virtual ~RendererBase(); | 39 | virtual ~RendererBase(); |
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index b2d5bfd3b..84e07f8bd 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h | |||
| @@ -7,12 +7,14 @@ | |||
| 7 | #include <string_view> | 7 | #include <string_view> |
| 8 | #include <utility> | 8 | #include <utility> |
| 9 | #include <glad/glad.h> | 9 | #include <glad/glad.h> |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_funcs.h" |
| 11 | 11 | ||
| 12 | namespace OpenGL { | 12 | namespace OpenGL { |
| 13 | 13 | ||
| 14 | class OGLRenderbuffer : private NonCopyable { | 14 | class OGLRenderbuffer final { |
| 15 | public: | 15 | public: |
| 16 | YUZU_NON_COPYABLE(OGLRenderbuffer); | ||
| 17 | |||
| 16 | OGLRenderbuffer() = default; | 18 | OGLRenderbuffer() = default; |
| 17 | 19 | ||
| 18 | OGLRenderbuffer(OGLRenderbuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 20 | OGLRenderbuffer(OGLRenderbuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -36,8 +38,10 @@ public: | |||
| 36 | GLuint handle = 0; | 38 | GLuint handle = 0; |
| 37 | }; | 39 | }; |
| 38 | 40 | ||
| 39 | class OGLTexture : private NonCopyable { | 41 | class OGLTexture final { |
| 40 | public: | 42 | public: |
| 43 | YUZU_NON_COPYABLE(OGLTexture); | ||
| 44 | |||
| 41 | OGLTexture() = default; | 45 | OGLTexture() = default; |
| 42 | 46 | ||
| 43 | OGLTexture(OGLTexture&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 47 | OGLTexture(OGLTexture&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -61,8 +65,10 @@ public: | |||
| 61 | GLuint handle = 0; | 65 | GLuint handle = 0; |
| 62 | }; | 66 | }; |
| 63 | 67 | ||
| 64 | class OGLTextureView : private NonCopyable { | 68 | class OGLTextureView final { |
| 65 | public: | 69 | public: |
| 70 | YUZU_NON_COPYABLE(OGLTextureView); | ||
| 71 | |||
| 66 | OGLTextureView() = default; | 72 | OGLTextureView() = default; |
| 67 | 73 | ||
| 68 | OGLTextureView(OGLTextureView&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 74 | OGLTextureView(OGLTextureView&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -86,8 +92,10 @@ public: | |||
| 86 | GLuint handle = 0; | 92 | GLuint handle = 0; |
| 87 | }; | 93 | }; |
| 88 | 94 | ||
| 89 | class OGLSampler : private NonCopyable { | 95 | class OGLSampler final { |
| 90 | public: | 96 | public: |
| 97 | YUZU_NON_COPYABLE(OGLSampler); | ||
| 98 | |||
| 91 | OGLSampler() = default; | 99 | OGLSampler() = default; |
| 92 | 100 | ||
| 93 | OGLSampler(OGLSampler&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 101 | OGLSampler(OGLSampler&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -111,8 +119,10 @@ public: | |||
| 111 | GLuint handle = 0; | 119 | GLuint handle = 0; |
| 112 | }; | 120 | }; |
| 113 | 121 | ||
| 114 | class OGLShader : private NonCopyable { | 122 | class OGLShader final { |
| 115 | public: | 123 | public: |
| 124 | YUZU_NON_COPYABLE(OGLShader); | ||
| 125 | |||
| 116 | OGLShader() = default; | 126 | OGLShader() = default; |
| 117 | 127 | ||
| 118 | OGLShader(OGLShader&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 128 | OGLShader(OGLShader&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -132,8 +142,10 @@ public: | |||
| 132 | GLuint handle = 0; | 142 | GLuint handle = 0; |
| 133 | }; | 143 | }; |
| 134 | 144 | ||
| 135 | class OGLProgram : private NonCopyable { | 145 | class OGLProgram final { |
| 136 | public: | 146 | public: |
| 147 | YUZU_NON_COPYABLE(OGLProgram); | ||
| 148 | |||
| 137 | OGLProgram() = default; | 149 | OGLProgram() = default; |
| 138 | 150 | ||
| 139 | OGLProgram(OGLProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 151 | OGLProgram(OGLProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -154,8 +166,10 @@ public: | |||
| 154 | GLuint handle = 0; | 166 | GLuint handle = 0; |
| 155 | }; | 167 | }; |
| 156 | 168 | ||
| 157 | class OGLAssemblyProgram : private NonCopyable { | 169 | class OGLAssemblyProgram final { |
| 158 | public: | 170 | public: |
| 171 | YUZU_NON_COPYABLE(OGLAssemblyProgram); | ||
| 172 | |||
| 159 | OGLAssemblyProgram() = default; | 173 | OGLAssemblyProgram() = default; |
| 160 | 174 | ||
| 161 | OGLAssemblyProgram(OGLAssemblyProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 175 | OGLAssemblyProgram(OGLAssemblyProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -176,8 +190,10 @@ public: | |||
| 176 | GLuint handle = 0; | 190 | GLuint handle = 0; |
| 177 | }; | 191 | }; |
| 178 | 192 | ||
| 179 | class OGLPipeline : private NonCopyable { | 193 | class OGLPipeline final { |
| 180 | public: | 194 | public: |
| 195 | YUZU_NON_COPYABLE(OGLPipeline); | ||
| 196 | |||
| 181 | OGLPipeline() = default; | 197 | OGLPipeline() = default; |
| 182 | OGLPipeline(OGLPipeline&& o) noexcept : handle{std::exchange<GLuint>(o.handle, 0)} {} | 198 | OGLPipeline(OGLPipeline&& o) noexcept : handle{std::exchange<GLuint>(o.handle, 0)} {} |
| 183 | 199 | ||
| @@ -198,8 +214,10 @@ public: | |||
| 198 | GLuint handle = 0; | 214 | GLuint handle = 0; |
| 199 | }; | 215 | }; |
| 200 | 216 | ||
| 201 | class OGLBuffer : private NonCopyable { | 217 | class OGLBuffer final { |
| 202 | public: | 218 | public: |
| 219 | YUZU_NON_COPYABLE(OGLBuffer); | ||
| 220 | |||
| 203 | OGLBuffer() = default; | 221 | OGLBuffer() = default; |
| 204 | 222 | ||
| 205 | OGLBuffer(OGLBuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 223 | OGLBuffer(OGLBuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -223,8 +241,10 @@ public: | |||
| 223 | GLuint handle = 0; | 241 | GLuint handle = 0; |
| 224 | }; | 242 | }; |
| 225 | 243 | ||
| 226 | class OGLSync : private NonCopyable { | 244 | class OGLSync final { |
| 227 | public: | 245 | public: |
| 246 | YUZU_NON_COPYABLE(OGLSync); | ||
| 247 | |||
| 228 | OGLSync() = default; | 248 | OGLSync() = default; |
| 229 | 249 | ||
| 230 | OGLSync(OGLSync&& o) noexcept : handle(std::exchange(o.handle, nullptr)) {} | 250 | OGLSync(OGLSync&& o) noexcept : handle(std::exchange(o.handle, nullptr)) {} |
| @@ -247,8 +267,10 @@ public: | |||
| 247 | GLsync handle = 0; | 267 | GLsync handle = 0; |
| 248 | }; | 268 | }; |
| 249 | 269 | ||
| 250 | class OGLFramebuffer : private NonCopyable { | 270 | class OGLFramebuffer final { |
| 251 | public: | 271 | public: |
| 272 | YUZU_NON_COPYABLE(OGLFramebuffer); | ||
| 273 | |||
| 252 | OGLFramebuffer() = default; | 274 | OGLFramebuffer() = default; |
| 253 | 275 | ||
| 254 | OGLFramebuffer(OGLFramebuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 276 | OGLFramebuffer(OGLFramebuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |
| @@ -272,8 +294,10 @@ public: | |||
| 272 | GLuint handle = 0; | 294 | GLuint handle = 0; |
| 273 | }; | 295 | }; |
| 274 | 296 | ||
| 275 | class OGLQuery : private NonCopyable { | 297 | class OGLQuery final { |
| 276 | public: | 298 | public: |
| 299 | YUZU_NON_COPYABLE(OGLQuery); | ||
| 300 | |||
| 277 | OGLQuery() = default; | 301 | OGLQuery() = default; |
| 278 | 302 | ||
| 279 | OGLQuery(OGLQuery&& o) noexcept : handle(std::exchange(o.handle, 0)) {} | 303 | OGLQuery(OGLQuery&& o) noexcept : handle(std::exchange(o.handle, 0)) {} |