diff options
| author | 2021-08-06 23:05:01 -0700 | |
|---|---|---|
| committer | 2021-12-06 16:39:16 -0800 | |
| commit | 4c18a207a4898f391afab5d7e44c1c2921bc9d6f (patch) | |
| tree | 6d54ba9561b01681820f06e0d6530d79676546f6 /src | |
| parent | core: hle: kernel: k_thread: Add KScopedDisableDispatch. (diff) | |
| download | yuzu-4c18a207a4898f391afab5d7e44c1c2921bc9d6f.tar.gz yuzu-4c18a207a4898f391afab5d7e44c1c2921bc9d6f.tar.xz yuzu-4c18a207a4898f391afab5d7e44c1c2921bc9d6f.zip | |
core: hle: kernel: k_handle_table: Use KScopedDisableDispatch as necessary.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/k_handle_table.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_handle_table.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_handle_table.cpp b/src/core/hle/kernel/k_handle_table.cpp index e90fc0628..cf95f0852 100644 --- a/src/core/hle/kernel/k_handle_table.cpp +++ b/src/core/hle/kernel/k_handle_table.cpp | |||
| @@ -13,6 +13,7 @@ ResultCode KHandleTable::Finalize() { | |||
| 13 | // Get the table and clear our record of it. | 13 | // Get the table and clear our record of it. |
| 14 | u16 saved_table_size = 0; | 14 | u16 saved_table_size = 0; |
| 15 | { | 15 | { |
| 16 | KScopedDisableDispatch dd(kernel); | ||
| 16 | KScopedSpinLock lk(m_lock); | 17 | KScopedSpinLock lk(m_lock); |
| 17 | 18 | ||
| 18 | std::swap(m_table_size, saved_table_size); | 19 | std::swap(m_table_size, saved_table_size); |
| @@ -43,6 +44,7 @@ bool KHandleTable::Remove(Handle handle) { | |||
| 43 | // Find the object and free the entry. | 44 | // Find the object and free the entry. |
| 44 | KAutoObject* obj = nullptr; | 45 | KAutoObject* obj = nullptr; |
| 45 | { | 46 | { |
| 47 | KScopedDisableDispatch dd(kernel); | ||
| 46 | KScopedSpinLock lk(m_lock); | 48 | KScopedSpinLock lk(m_lock); |
| 47 | 49 | ||
| 48 | if (this->IsValidHandle(handle)) { | 50 | if (this->IsValidHandle(handle)) { |
| @@ -62,6 +64,7 @@ bool KHandleTable::Remove(Handle handle) { | |||
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) { | 66 | ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) { |
| 67 | KScopedDisableDispatch dd(kernel); | ||
| 65 | KScopedSpinLock lk(m_lock); | 68 | KScopedSpinLock lk(m_lock); |
| 66 | 69 | ||
| 67 | // Never exceed our capacity. | 70 | // Never exceed our capacity. |
| @@ -84,6 +87,7 @@ ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) { | |||
| 84 | } | 87 | } |
| 85 | 88 | ||
| 86 | ResultCode KHandleTable::Reserve(Handle* out_handle) { | 89 | ResultCode KHandleTable::Reserve(Handle* out_handle) { |
| 90 | KScopedDisableDispatch dd(kernel); | ||
| 87 | KScopedSpinLock lk(m_lock); | 91 | KScopedSpinLock lk(m_lock); |
| 88 | 92 | ||
| 89 | // Never exceed our capacity. | 93 | // Never exceed our capacity. |
| @@ -94,6 +98,7 @@ ResultCode KHandleTable::Reserve(Handle* out_handle) { | |||
| 94 | } | 98 | } |
| 95 | 99 | ||
| 96 | void KHandleTable::Unreserve(Handle handle) { | 100 | void KHandleTable::Unreserve(Handle handle) { |
| 101 | KScopedDisableDispatch dd(kernel); | ||
| 97 | KScopedSpinLock lk(m_lock); | 102 | KScopedSpinLock lk(m_lock); |
| 98 | 103 | ||
| 99 | // Unpack the handle. | 104 | // Unpack the handle. |
| @@ -112,6 +117,7 @@ void KHandleTable::Unreserve(Handle handle) { | |||
| 112 | } | 117 | } |
| 113 | 118 | ||
| 114 | void KHandleTable::Register(Handle handle, KAutoObject* obj, u16 type) { | 119 | void KHandleTable::Register(Handle handle, KAutoObject* obj, u16 type) { |
| 120 | KScopedDisableDispatch dd(kernel); | ||
| 115 | KScopedSpinLock lk(m_lock); | 121 | KScopedSpinLock lk(m_lock); |
| 116 | 122 | ||
| 117 | // Unpack the handle. | 123 | // Unpack the handle. |
diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h index 95ec905ae..4b114ec2f 100644 --- a/src/core/hle/kernel/k_handle_table.h +++ b/src/core/hle/kernel/k_handle_table.h | |||
| @@ -68,6 +68,7 @@ public: | |||
| 68 | template <typename T = KAutoObject> | 68 | template <typename T = KAutoObject> |
| 69 | KScopedAutoObject<T> GetObjectWithoutPseudoHandle(Handle handle) const { | 69 | KScopedAutoObject<T> GetObjectWithoutPseudoHandle(Handle handle) const { |
| 70 | // Lock and look up in table. | 70 | // Lock and look up in table. |
| 71 | KScopedDisableDispatch dd(kernel); | ||
| 71 | KScopedSpinLock lk(m_lock); | 72 | KScopedSpinLock lk(m_lock); |
| 72 | 73 | ||
| 73 | if constexpr (std::is_same_v<T, KAutoObject>) { | 74 | if constexpr (std::is_same_v<T, KAutoObject>) { |
| @@ -122,6 +123,7 @@ public: | |||
| 122 | size_t num_opened; | 123 | size_t num_opened; |
| 123 | { | 124 | { |
| 124 | // Lock the table. | 125 | // Lock the table. |
| 126 | KScopedDisableDispatch dd(kernel); | ||
| 125 | KScopedSpinLock lk(m_lock); | 127 | KScopedSpinLock lk(m_lock); |
| 126 | for (num_opened = 0; num_opened < num_handles; num_opened++) { | 128 | for (num_opened = 0; num_opened < num_handles; num_opened++) { |
| 127 | // Get the current handle. | 129 | // Get the current handle. |