diff options
| author | 2021-08-06 23:05:01 -0700 | |
|---|---|---|
| committer | 2021-08-07 12:18:47 -0700 | |
| commit | f2b0d289833be94401edb4bb3b5b891fcda713d4 (patch) | |
| tree | 5fe74ac28d1f0bd2d1ef96526d6712cf28833c1e /src/core | |
| parent | core: hle: kernel: k_thread: Add KScopedDisableDispatch. (diff) | |
| download | yuzu-f2b0d289833be94401edb4bb3b5b891fcda713d4.tar.gz yuzu-f2b0d289833be94401edb4bb3b5b891fcda713d4.tar.xz yuzu-f2b0d289833be94401edb4bb3b5b891fcda713d4.zip | |
core: hle: kernel: k_handle_table: Use KScopedDisableDispatch as necessary.
Diffstat (limited to 'src/core')
| -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 6a420d5b0..d720c2dda 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)) { |
| @@ -61,6 +63,7 @@ bool KHandleTable::Remove(Handle handle) { | |||
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) { | 65 | ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) { |
| 66 | KScopedDisableDispatch dd(kernel); | ||
| 64 | KScopedSpinLock lk(m_lock); | 67 | KScopedSpinLock lk(m_lock); |
| 65 | 68 | ||
| 66 | // Never exceed our capacity. | 69 | // Never exceed our capacity. |
| @@ -83,6 +86,7 @@ ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) { | |||
| 83 | } | 86 | } |
| 84 | 87 | ||
| 85 | ResultCode KHandleTable::Reserve(Handle* out_handle) { | 88 | ResultCode KHandleTable::Reserve(Handle* out_handle) { |
| 89 | KScopedDisableDispatch dd(kernel); | ||
| 86 | KScopedSpinLock lk(m_lock); | 90 | KScopedSpinLock lk(m_lock); |
| 87 | 91 | ||
| 88 | // Never exceed our capacity. | 92 | // Never exceed our capacity. |
| @@ -93,6 +97,7 @@ ResultCode KHandleTable::Reserve(Handle* out_handle) { | |||
| 93 | } | 97 | } |
| 94 | 98 | ||
| 95 | void KHandleTable::Unreserve(Handle handle) { | 99 | void KHandleTable::Unreserve(Handle handle) { |
| 100 | KScopedDisableDispatch dd(kernel); | ||
| 96 | KScopedSpinLock lk(m_lock); | 101 | KScopedSpinLock lk(m_lock); |
| 97 | 102 | ||
| 98 | // Unpack the handle. | 103 | // Unpack the handle. |
| @@ -111,6 +116,7 @@ void KHandleTable::Unreserve(Handle handle) { | |||
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | void KHandleTable::Register(Handle handle, KAutoObject* obj, u16 type) { | 118 | void KHandleTable::Register(Handle handle, KAutoObject* obj, u16 type) { |
| 119 | KScopedDisableDispatch dd(kernel); | ||
| 114 | KScopedSpinLock lk(m_lock); | 120 | KScopedSpinLock lk(m_lock); |
| 115 | 121 | ||
| 116 | // Unpack the handle. | 122 | // Unpack the handle. |
diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h index 2ff6aa160..75dcec7df 100644 --- a/src/core/hle/kernel/k_handle_table.h +++ b/src/core/hle/kernel/k_handle_table.h | |||
| @@ -69,6 +69,7 @@ public: | |||
| 69 | template <typename T = KAutoObject> | 69 | template <typename T = KAutoObject> |
| 70 | KScopedAutoObject<T> GetObjectWithoutPseudoHandle(Handle handle) const { | 70 | KScopedAutoObject<T> GetObjectWithoutPseudoHandle(Handle handle) const { |
| 71 | // Lock and look up in table. | 71 | // Lock and look up in table. |
| 72 | KScopedDisableDispatch dd(kernel); | ||
| 72 | KScopedSpinLock lk(m_lock); | 73 | KScopedSpinLock lk(m_lock); |
| 73 | 74 | ||
| 74 | if constexpr (std::is_same_v<T, KAutoObject>) { | 75 | if constexpr (std::is_same_v<T, KAutoObject>) { |
| @@ -123,6 +124,7 @@ public: | |||
| 123 | size_t num_opened; | 124 | size_t num_opened; |
| 124 | { | 125 | { |
| 125 | // Lock the table. | 126 | // Lock the table. |
| 127 | KScopedDisableDispatch dd(kernel); | ||
| 126 | KScopedSpinLock lk(m_lock); | 128 | KScopedSpinLock lk(m_lock); |
| 127 | for (num_opened = 0; num_opened < num_handles; num_opened++) { | 129 | for (num_opened = 0; num_opened < num_handles; num_opened++) { |
| 128 | // Get the current handle. | 130 | // Get the current handle. |