Nucleus
Barry Virtual Memory Regions and namespace 381dc7b (3 years, 3 months ago)diff --git a/task/clone.c b/task/clone.c index c9a6dc0..0ec2f95 100644 --- a/task/clone.c +++ b/task/clone.c @@ -32,6 +32,12 @@ clone(int flags) else child->files = copy(parent->files); + /* Clone parent's virtual memory namespace */ + if (flags & CLONE_VM) + child->vm = get(parent->fs); + else + child->fs = copy(parent->fs); + /* After this, anything on the stack is desynchronised */ child->pageDir = clone_dir(); diff --git a/task/scheduler.c b/task/scheduler.c index 5cb1440..3a9605c 100644 --- a/task/scheduler.c +++ b/task/scheduler.c @@ -28,7 +28,7 @@ switch_to_task(Task *task) } /* Switch to new context */ - current = task; /* Use the passed reference */ + current = task; /* Given reference, so no get() */ asm volatile ( "cli;" "movl %0, %%ecx;" diff --git a/task/task.c b/task/task.c index 0e53b77..b23c54b 100644 --- a/task/task.c +++ b/task/task.c @@ -81,9 +81,10 @@ init_tasking(void) /* File System namespace */ current->fs = new(&fsType); - /* Files namespace */ current->files = new(&filesType); + /* Virtual Memory namespace */ + current->vm = new(&virtualMemoryType); init_scheduler(); register_interrupt(0, timer_handler);