Compare commits

...

2 Commits

Author SHA1 Message Date
7660bcab82 proc_wait_for () lock wait_proc to avoid races
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 55s
Build documentation / build-and-deploy (push) Successful in 37s
2026-04-16 22:00:42 +02:00
9346a10d74 idedrv Reject drive request if idedrv->current_req != NULL 2026-04-16 21:59:46 +02:00
2 changed files with 10 additions and 0 deletions

View File

@@ -286,6 +286,9 @@ DEFINE_DEVICE_OP (idedrv_read) {
if (sector + sector_count > idedrv->sector_count)
return -ST_OOB_ERROR;
if (idedrv->current_req != NULL)
return -ST_TRY_AGAIN;
if (!ide_wait (idedrv->io, 100000, false, false))
return -ST_XDRV_READ_ERROR;
@@ -347,6 +350,9 @@ DEFINE_DEVICE_OP (idedrv_write) {
if (sector + sector_count > idedrv->sector_count)
return -ST_OOB_ERROR;
if (idedrv->current_req != NULL)
return -ST_TRY_AGAIN;
if (!ide_wait (idedrv->io, 100000, false, false))
return -ST_XDRV_WRITE_ERROR;

View File

@@ -378,7 +378,11 @@ void proc_kill (struct proc* proc, struct reschedule_ctx* rctx) {
}
void proc_wait_for (struct proc* proc, struct reschedule_ctx* rctx, struct proc* wait_proc) {
uint64_t fwp;
spin_lock (&wait_proc->lock, &fwp);
proc_sq_suspend (proc, &wait_proc->done_sq, NULL, 0, rctx, NULL, NULL);
spin_unlock (&wait_proc->lock, fwp);
}
void proc_irq_sched (void* arg, void* regs, bool user, struct reschedule_ctx* rctx) {