diff options
author | Marvin Borner | 2020-08-25 21:14:47 +0200 |
---|---|---|
committer | Marvin Borner | 2020-08-25 21:14:47 +0200 |
commit | d2017fca3efefdb4d514f2b356855a0fda1fccfd (patch) | |
tree | ebfddbbb5c6c30ae309085a6d3457b9146cd8e6c /kernel | |
parent | 0724b54018c379850e672ad6571e05b3f848150d (diff) |
Some optimizations or sth
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/features/proc.c | 7 | ||||
-rw-r--r-- | kernel/features/syscall.c | 2 | ||||
-rw-r--r-- | kernel/inc/proc.h | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c index 5b4da1f..021a3d6 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -114,9 +114,8 @@ struct proc *proc_from_pid(u32 pid) { struct node *iterator = proc_list->head; do { - if (((struct proc *)iterator->data)->pid == pid) { + if (((struct proc *)iterator->data)->pid == pid) return iterator->data; - } } while ((iterator = iterator->next) != NULL); return NULL; } @@ -139,10 +138,10 @@ void proc_exit(struct proc *proc, int status) hlt(); } -// TODO: More instant yield -void proc_yield() +void proc_yield(struct regs *r) { quantum = 0; + scheduler(r); } struct proc *proc_make() diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index fb6adf1..fbbb68b 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -71,7 +71,7 @@ void syscall_handler(struct regs *r) } case SYS_YIELD: { /* printf("yield\n"); */ - proc_yield(); + proc_yield(r); break; } case SYS_TIME: { diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h index 36d8e85..0c0ec9e 100644 --- a/kernel/inc/proc.h +++ b/kernel/inc/proc.h @@ -43,7 +43,7 @@ void proc_send(struct proc *src, struct proc *dest, enum message_type type, void struct proc_message *proc_receive(struct proc *proc); struct proc *proc_from_pid(u32 pid); void proc_exit(struct proc *proc, int status); -void proc_yield(); +void proc_yield(struct regs *r); struct proc *proc_make(); #endif |