1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:57:44 +00:00

Add SpinLock to IDE disk access.

This forces serialization of accesses. This driver needs to be redesigned.
This commit is contained in:
Andreas Kling 2018-10-31 21:31:56 +01:00
parent dec5683e9c
commit 8f6998c902
7 changed files with 57 additions and 13 deletions

View file

@ -73,8 +73,11 @@ void interrupt()
interrupted = true;
}
static SpinLock* s_diskLock;
void initialize()
{
s_diskLock = new SpinLock;
disableIRQ();
interrupted = false;
registerInterruptHandler(IRQ_VECTOR_BASE + IRQ_FIXED_DISK, ide_ISR);
@ -135,6 +138,7 @@ static CHS lba2chs(BYTE drive_index, DWORD lba)
bool readSectors(DWORD startSector, WORD count, BYTE* outbuf)
{
LOCKER(*s_diskLock);
#ifdef DISK_DEBUG
kprintf("%s: Disk::readSectors request (%u sector(s) @ %u)\n",
current->name().characters(),