]> git.corax.cc Git - corax/commitdiff
Initialize the process's time slice and put it on the ready queue in process_create()
authorMatthias Kruk <m@m10k.eu>
Sun, 29 Sep 2019 05:52:25 +0000 (14:52 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 29 Sep 2019 05:52:25 +0000 (14:52 +0900)
kernel/core/process.c

index fb0b75c2b277f9c26b30db92fbe57dab12d9d901..8562f51234d728b197a4e15474a45d5cb2c1b1b1 100644 (file)
@@ -5,6 +5,7 @@
 #include <arch.h>
 #include <debug.h>
 #include <process.h>
+#include "sched.h"
 
 struct process {
        struct pagedir *p_pgdir;
@@ -12,6 +13,8 @@ struct process {
        u32_t          p_privl;
 };
 
+extern int sched_enqueue(task_t*);
+
 int process_create(process_t **dst, u32_t ppl, void *entry)
 {
        int ret_val;
@@ -49,6 +52,13 @@ int process_create(process_t **dst, u32_t ppl, void *entry)
 
                proc->p_tasks->t_sp = (u32_t)(CONFIG_KERNEL_STACK_BASE +
                                                                          ((u32_t)proc->p_tasks->t_sp - (u32_t)kstack));
+
+               proc->p_tasks->t_tslice = 50;
+               proc->p_tasks->t_rslice = 50;
+
+               if(sched_enqueue(proc->p_tasks) != 0) {
+                       PANIC("sched_enqueue() failed for a new task\n");
+               }
        }
 
 cleanup: