diff --git a/kernel/include/kernel/Storage/ATABus.h b/kernel/include/kernel/Storage/ATABus.h index c9c2db0c..baf83bb8 100644 --- a/kernel/include/kernel/Storage/ATABus.h +++ b/kernel/include/kernel/Storage/ATABus.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include @@ -56,7 +55,6 @@ namespace Kernel const uint16_t m_base; const uint16_t m_ctrl; SpinLock m_lock; - Semaphore m_semaphore; bool m_has_got_irq { false }; diff --git a/kernel/kernel/Storage/ATABus.cpp b/kernel/kernel/Storage/ATABus.cpp index 3251c340..158f5370 100644 --- a/kernel/kernel/Storage/ATABus.cpp +++ b/kernel/kernel/Storage/ATABus.cpp @@ -151,14 +151,12 @@ namespace Kernel if (io_read(ATA_PORT_STATUS) & ATA_STATUS_ERR) dprintln("ATA Error: {}", error()); m_has_got_irq = true; - m_semaphore.unblock(); } void ATABus::block_until_irq() { - if (!m_has_got_irq) - m_semaphore.block(); - m_has_got_irq = false; + while (!__sync_bool_compare_and_swap(&m_has_got_irq, true, false)) + __builtin_ia32_pause(); } uint8_t ATABus::io_read(uint16_t port)