mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-11 13:39:55 +02:00
System/Setup/Environment: Disable exclusive access to BlkDev and Drv
This sidesteps a deadlocking issue most commonly encountered when entering SystemStarter, as multiple tasks are attempting to access resources on the same RedSea file system.
This commit is contained in:
@@ -16,32 +16,12 @@ U0 NoBeep(I8, Bool) {};
|
|||||||
@patch_jmp_rel32(&Beep, &NoBeep); // Don't delay on beep when entering debugger
|
@patch_jmp_rel32(&Beep, &NoBeep); // Don't delay on beep when entering debugger
|
||||||
//@patch_jmp_rel32(&Fault2, &Reboot); // Reboot instead of crashing to the debugger
|
//@patch_jmp_rel32(&Fault2, &Reboot); // Reboot instead of crashing to the debugger
|
||||||
|
|
||||||
Bool BlkDevLock2(CBlkDev* bd)
|
// 4. Disable exclusive access to BlkDev and Drv
|
||||||
|
|
||||||
|
Bool FakeLock(U64)
|
||||||
{
|
{
|
||||||
BlkDevChk(bd);
|
return TRUE;
|
||||||
while (bd->lock_fwding)
|
|
||||||
bd = bd->lock_fwding;
|
|
||||||
if (!Bt(&bd->locked_flags, BDlf_LOCKED) || bd->owning_task != Fs) {
|
|
||||||
while (LBts(&bd->locked_flags, BDlf_LOCKED))
|
|
||||||
Sleep(Rand * 10);
|
|
||||||
bd->owning_task = Fs;
|
|
||||||
return TRUE;
|
|
||||||
} else
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool DrvLock2(CDrv* dv)
|
@patch_jmp_rel32(&BlkDevLock, &FakeLock);
|
||||||
{
|
@patch_jmp_rel32(&DrvLock, &FakeLock);
|
||||||
DrvChk(dv);
|
|
||||||
BlkDevLock2(dv->bd);
|
|
||||||
if (!Bt(&dv->locked_flags, DVlf_LOCKED) || dv->owning_task != Fs) {
|
|
||||||
while (LBts(&dv->locked_flags, DVlf_LOCKED))
|
|
||||||
Sleep(Rand * 10);
|
|
||||||
dv->owning_task = Fs;
|
|
||||||
return TRUE;
|
|
||||||
} else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@patch_jmp_rel32(&BlkDevLock, &BlkDevLock2); // Patch BlkDevLock so we don't deadlock on multiple tasks reading from virtio disk
|
|
||||||
@patch_jmp_rel32(&DrvLock, &DrvLock2); // Patch DrvLock so we don't deadlock on multiple tasks reading from virtio disk
|
|
||||||
|
|||||||
Reference in New Issue
Block a user