diff options
author | Marvin Borner | 2020-08-22 23:31:47 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-22 23:31:47 +0200 |
commit | b667ea0fbd26af222f828199e7b9a7e62ad98081 (patch) | |
tree | 90dac52e2cf0a898da0097e9b1375506309b673f /kernel/features/proc.c | |
parent | 32f63ffc96f7f7ec6c504b8f50292316f026dd21 (diff) |
Some window fb and yield implementation
Diffstat (limited to 'kernel/features/proc.c')
-rw-r--r-- | kernel/features/proc.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c index d1a2780..1c0b443 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -17,8 +17,11 @@ u32 quantum = 0; struct list *proc_list; struct node *current; +// TODO: Use less memcpy and only copy relevant registers void scheduler(struct regs *regs) { + timer_handler(); + if (quantum == 0) { quantum = PROC_QUANTUM; } else { @@ -34,8 +37,6 @@ void scheduler(struct regs *regs) if (current) memcpy(&((struct proc *)current->data)->regs, regs, sizeof(struct regs)); - timer_handler(); - if (current && current->next) current = current->next; else @@ -71,9 +72,9 @@ void scheduler(struct regs *regs) quantum = PROC_QUANTUM; proc->state = PROC_IN_EVENT; - list_remove(proc->events, proc->events->head); regs->useresp += 4; ((u32 *)regs->useresp)[1] = (u32)proc_event->data; // Huh + list_remove(proc->events, proc->events->head); } /* printf("{%d}", ((struct proc *)current->data)->pid); */ @@ -158,6 +159,12 @@ void proc_exit(struct proc *proc, int status) hlt(); } +// TODO: More instant yield +void proc_yield() +{ + quantum = 0; +} + struct proc *proc_make() { struct proc *proc = malloc(sizeof(*proc)); |