diff options
author | Marvin Borner | 2020-09-11 22:54:38 +0200 |
---|---|---|
committer | Marvin Borner | 2020-09-11 22:54:38 +0200 |
commit | e37e7eefcb0148651331d6a750846f26ecf11126 (patch) | |
tree | 2aad5993414d344900a7ade53ccddbc8586ccb54 /kernel | |
parent | 8eb9ee85529a6140a533ffeb52f5e7f4078d9f27 (diff) |
Removed wait syscall - whoopsidoo!
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/features/proc.c | 28 | ||||
-rw-r--r-- | kernel/features/syscall.c | 8 | ||||
-rw-r--r-- | kernel/inc/proc.h | 3 |
3 files changed, 5 insertions, 34 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c index 19845d4..09f1f4e 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -32,23 +32,13 @@ void scheduler(struct regs *regs) assert(proc_list->head); - if (current) - memcpy(&((struct proc *)current->data)->regs, regs, sizeof(struct regs)); + memcpy(&((struct proc *)current->data)->regs, regs, sizeof(struct regs)); - if (current && current->next) + if (current->next) current = current->next; else current = proc_list->head; - while (((struct proc *)current->data)->state == PROC_WAITING) { - /* assert(proc_awake() > 0); */ - if (current && current->next && current->next->data) { - current = current->next; - } else { - current = proc_list->head; - } - } - memcpy(regs, &((struct proc *)current->data)->regs, sizeof(struct regs)); if (regs->cs != GDT_USER_CODE_OFFSET) { @@ -92,17 +82,6 @@ struct proc *proc_current() return current && current->data ? current->data : NULL; } -int proc_awake() -{ - int ret = 0; - struct node *iterator = proc_list->head; - do { - if (((struct proc *)iterator->data)->state != PROC_WAITING) - ret++; - } while ((iterator = iterator->next) != NULL); - return ret; -} - void proc_send(struct proc *src, struct proc *dest, enum message_type type, void *data) { // TODO: Use unique key instead of pid for IPC messaging @@ -115,8 +94,6 @@ void proc_send(struct proc *src, struct proc *dest, enum message_type type, void msg->msg->type = type; msg->msg->data = data; list_add(dest->messages, msg); - if (dest->state == PROC_WAITING) - dest->state = PROC_DEFAULT; } struct proc_message *proc_receive(struct proc *proc) @@ -198,6 +175,7 @@ void proc_init() struct node *new = list_add(proc_list, proc_make()); bin_load("/init", new->data); + current = new; _eip = ((struct proc *)new->data)->regs.eip; _esp = ((struct proc *)new->data)->regs.useresp; diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index b3af455..25770a4 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -17,7 +17,7 @@ void syscall_handler(struct regs *r) enum sys num = r->eax; r->eax = 0; - if (num != SYS_RECEIVE && num != SYS_YIELD && num != SYS_WAIT && num != SYS_TIME) + if (num != SYS_RECEIVE && num != SYS_YIELD && num != SYS_TIME) printf("[SYSCALL] %d from %s: ", num, proc_current()->name); switch (num) { @@ -74,12 +74,6 @@ void syscall_handler(struct regs *r) proc_yield(r); break; } - case SYS_WAIT: { - /* printf("wait\n"); */ - proc_current()->state = PROC_WAITING; - proc_yield(r); - break; - } case SYS_TIME: { /* printf("time\n"); */ r->eax = timer_get(); diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h index 9d4906d..89144ca 100644 --- a/kernel/inc/proc.h +++ b/kernel/inc/proc.h @@ -17,7 +17,7 @@ #define GDT_USER_CODE_OFFSET 0x1b // User code segment offset in GDT (with ring3 mask) #define GDT_USER_DATA_OFFSET 0x23 // User data segment offset in GDT (with ring3 mask) -enum proc_state { PROC_DEFAULT, PROC_WAITING }; +enum proc_state { PROC_DEFAULT }; struct proc { u32 pid; @@ -41,7 +41,6 @@ void scheduler_disable(); void proc_init(); void proc_print(); struct proc *proc_current(); -int proc_awake(); void proc_send(struct proc *src, struct proc *dest, enum message_type type, void *data); struct proc_message *proc_receive(struct proc *proc); struct proc *proc_from_pid(u32 pid); |