kern: remove per-KInterruptEventTask locks

This commit is contained in:
Michael Scire 2021-09-17 15:34:24 -07:00 committed by SciresM
parent e6a6fe6f38
commit 29cc3d1c09
2 changed files with 9 additions and 12 deletions

View file

@ -48,13 +48,10 @@ namespace ams::kern {
class KInterruptEventTask : public KSlabAllocated<KInterruptEventTask>, public KInterruptTask { class KInterruptEventTask : public KSlabAllocated<KInterruptEventTask>, public KInterruptTask {
private: private:
KInterruptEvent *m_event; KInterruptEvent *m_event;
KLightLock m_lock;
public: public:
constexpr KInterruptEventTask() : m_event(nullptr), m_lock() { /* ... */ } constexpr KInterruptEventTask() : m_event(nullptr) { /* ... */ }
~KInterruptEventTask() { /* ... */ } ~KInterruptEventTask() { /* ... */ }
KLightLock &GetLock() { return m_lock; }
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override; virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override;
virtual void DoTask() override; virtual void DoTask() override;

View file

@ -60,8 +60,8 @@ namespace ams::kern {
Result KInterruptEvent::Reset() { Result KInterruptEvent::Reset() {
MESOSPHERE_ASSERT_THIS(); MESOSPHERE_ASSERT_THIS();
/* Lock the task. */ /* Lock the scheduler. */
KScopedLightLock lk(g_interrupt_event_task_table[m_interrupt_id]->GetLock()); KScopedSchedulerLock sl;
/* Clear the event. */ /* Clear the event. */
R_TRY(KReadableEvent::Reset()); R_TRY(KReadableEvent::Reset());
@ -95,8 +95,8 @@ namespace ams::kern {
/* Register/bind the interrupt task. */ /* Register/bind the interrupt task. */
{ {
/* Acqquire exclusive access to the task. */ /* Lock the scheduler. */
KScopedLightLock tlk(task->m_lock); KScopedSchedulerLock sl;
/* Bind the interrupt handler. */ /* Bind the interrupt handler. */
R_TRY(Kernel::GetInterruptManager().BindHandler(task, interrupt_id, core_id, KInterruptController::PriorityLevel_High, true, level)); R_TRY(Kernel::GetInterruptManager().BindHandler(task, interrupt_id, core_id, KInterruptController::PriorityLevel_High, true, level));
@ -121,8 +121,8 @@ namespace ams::kern {
/* Lock the task table. */ /* Lock the task table. */
KScopedLightLock lk(g_interrupt_event_lock); KScopedLightLock lk(g_interrupt_event_lock);
/* Lock the task. */ /* Lock the scheduler. */
KScopedLightLock tlk(m_lock); KScopedSchedulerLock sl;
/* Ensure we can unregister. */ /* Ensure we can unregister. */
MESOSPHERE_ABORT_UNLESS(g_interrupt_event_task_table[interrupt_id] == this); MESOSPHERE_ABORT_UNLESS(g_interrupt_event_task_table[interrupt_id] == this);
@ -142,8 +142,8 @@ namespace ams::kern {
void KInterruptEventTask::DoTask() { void KInterruptEventTask::DoTask() {
MESOSPHERE_ASSERT_THIS(); MESOSPHERE_ASSERT_THIS();
/* Lock the task table. */ /* Lock the scheduler. */
KScopedLightLock lk(m_lock); KScopedSchedulerLock sl;
if (m_event != nullptr) { if (m_event != nullptr) {
m_event->Signal(); m_event->Signal();