diff --git a/kernel/include/kernel/Storage/ATAController.h b/kernel/include/kernel/Storage/ATAController.h index 34c64a16a9..81904ea0ef 100644 --- a/kernel/include/kernel/Storage/ATAController.h +++ b/kernel/include/kernel/Storage/ATAController.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include namespace Kernel @@ -33,6 +34,7 @@ namespace Kernel char model[41]; ATABus* bus; + SpinLock m_lock; friend class ATAController; }; diff --git a/kernel/kernel/Storage/ATAController.cpp b/kernel/kernel/Storage/ATAController.cpp index f7aa74b6ea..8dd5fadf8e 100644 --- a/kernel/kernel/Storage/ATAController.cpp +++ b/kernel/kernel/Storage/ATAController.cpp @@ -1,8 +1,7 @@ #include +#include #include -#include - #define ATA_PRIMARY 0 #define ATA_SECONDARY 1 @@ -189,6 +188,8 @@ namespace Kernel if (lba + sector_count > lba_count) return BAN::Error::from_string("Attempted to read outside of the device boundaries"); + LockGuard _(m_lock); + if (lba < (1 << 28)) { // LBA28 diff --git a/kernel/kernel/kernel.cpp b/kernel/kernel/kernel.cpp index bae10ec64c..fd8fe2683f 100644 --- a/kernel/kernel/kernel.cpp +++ b/kernel/kernel/kernel.cpp @@ -106,15 +106,12 @@ extern "C" void kernel_main() MUST(scheduler.add_thread(BAN::Function( [terminal_driver] { - //PCI::get().initialize_controllers(); - - //StorageDeviceManager::initialize(); if (auto error = VirtualFileSystem::initialize(); error.is_error()) { derrorln("{}", error.error()); return; } - + auto font_or_error = Font::load("/usr/share/fonts/zap-ext-vga16.psf"); if (font_or_error.is_error()) dprintln("{}", font_or_error.error());