Kernel: Add lock to Disk reads before I forget

This commit is contained in:
Bananymous 2023-02-26 03:48:11 +02:00
parent ee5d02aa70
commit 7d84f290a1
3 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include <BAN/Errors.h>
#include <kernel/SpinLock.h>
#include <kernel/Storage/StorageController.h>
namespace Kernel
@ -33,6 +34,7 @@ namespace Kernel
char model[41];
ATABus* bus;
SpinLock m_lock;
friend class ATAController;
};

View File

@ -1,8 +1,7 @@
#include <kernel/IO.h>
#include <kernel/LockGuard.h>
#include <kernel/Storage/ATAController.h>
#include <kernel/kprint.h>
#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

View File

@ -106,15 +106,12 @@ extern "C" void kernel_main()
MUST(scheduler.add_thread(BAN::Function<void()>(
[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());