diff options
author | Marvin Borner | 2021-01-20 23:22:32 +0100 |
---|---|---|
committer | Marvin Borner | 2021-01-20 23:22:32 +0100 |
commit | 64ccbef99bdadc816e8c756ca8b5ae9a148a47fd (patch) | |
tree | dc53211d20a6b711b5076cbb46119c42f77caae6 /kernel/features/proc.c | |
parent | 1ca3f322c81544ba769a0cd44fbd4bf03a8f875d (diff) |
Added proc wait struct with function
Diffstat (limited to 'kernel/features/proc.c')
-rw-r--r-- | kernel/features/proc.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c index af6a307..9af1ce4 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -125,21 +125,26 @@ void proc_exit(struct proc *proc, int status) hlt(); } -void proc_yield(struct regs *r) +void proc_clear_quantum() { quantum = 0; +} + +void proc_yield(struct regs *r) +{ + proc_clear_quantum(); scheduler(r); } void proc_enable_waiting(u32 dev_id) { - printf("ENABLING %d\n", dev_id); struct node *iterator = proc_list->head; while (iterator) { struct proc *p = iterator->data; - printf("\t-> %s: %d\n", p->name, p->waits_for); - if (p && p->waits_for && p->waits_for == dev_id) { - //printf("WAKING %s\n", p->name); + struct proc_wait *w = &p->wait; + if (p && w && w->id == dev_id) { + struct regs *r = &p->regs; + r->eax = (u32)w->func((char *)r->ebx, (void *)r->ecx, r->edx, r->esi); p->state = PROC_RUNNING; } iterator = iterator->next; |