]> git.corax.cc Git - corax/commitdiff
kernel/core: Update the process's tasks' t_kstack member when the process's page...
authorMatthias Kruk <m@m10k.eu>
Mon, 4 May 2020 17:08:32 +0000 (02:08 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 4 May 2020 17:08:40 +0000 (02:08 +0900)
kernel/core/process.c

index 07b16b38d357d5eac22008ffafe7291a6d3deadb..c22623bb4b7088a82fb14f56ba9d6374bd9cfcc6 100644 (file)
@@ -974,15 +974,28 @@ int process_set_pagedir(process_t *proc, pg_dir_t *pd)
        ret_val = -EINVAL;
 
        if(proc && pd) {
+               u32_t pdbr;
+               u32_t kstack;
                int i;
 
                /* FIXME: make sure none of the tasks are running */
                proc->p_pgdir = pd;
 
+               pdbr = (u32_t)pg_dir_get_pdbr(pd);
+               kstack = (u32_t)pg_dir_get_kstack(pd);
+
                /* FIXME: Set t_pgdir in all tasks */
                for(i = 0; i < CONFIG_PROC_MAXTASKS; i++) {
                        if(proc->p_tasks[i]) {
-                               proc->p_tasks[i]->t_pgdir = (u32_t)pg_dir_get_pdbr(pd);
+                               proc->p_tasks[i]->t_pgdir = pdbr;
+                               /*
+                                * FIXME: Allocate separate stacks for each task
+                                *
+                                * The only reason this is not catching fire right
+                                * away is that there is no threading yet. This *WILL*
+                                * break once pthreads are implemented.
+                                */
+                               proc->p_tasks[i]->t_kstack = kstack;
                        }
                }