/kernel/trunk/generic/src/proc/scheduler.c |
---|
32,7 → 32,7 |
#include <mm/heap.h> |
#include <mm/frame.h> |
#include <mm/page.h> |
#include <mm/vm.h> |
#include <mm/as.h> |
#include <arch/asm.h> |
#include <arch/faddr.h> |
#include <arch/atomic.h> |
352,28 → 352,28 |
* If both the old and the new task are the same, lots of work is avoided. |
*/ |
if (TASK != THREAD->task) { |
vm_t *m1 = NULL; |
vm_t *m2; |
as_t *as1 = NULL; |
as_t *as2; |
if (TASK) { |
spinlock_lock(&TASK->lock); |
m1 = TASK->vm; |
as1 = TASK->as; |
spinlock_unlock(&TASK->lock); |
} |
spinlock_lock(&THREAD->task->lock); |
m2 = THREAD->task->vm; |
as2 = THREAD->task->as; |
spinlock_unlock(&THREAD->task->lock); |
/* |
* Note that it is possible for two tasks to share one vm mapping. |
* Note that it is possible for two tasks to share one address space. |
*/ |
if (m1 != m2) { |
if (as1 != as2) { |
/* |
* Both tasks and vm mappings are different. |
* Both tasks and address spaces are different. |
* Replace the old one with the new one. |
*/ |
vm_install(m2); |
as_install(as2); |
} |
TASK = THREAD->task; |
} |
/kernel/trunk/generic/src/proc/the.c |
---|
42,7 → 42,7 |
the->cpu = NULL; |
the->thread = NULL; |
the->task = NULL; |
the->vm = NULL; |
the->as = NULL; |
} |
/** Copy THE structure |
/kernel/trunk/generic/src/proc/task.c |
---|
28,7 → 28,7 |
#include <proc/thread.h> |
#include <proc/task.h> |
#include <mm/vm.h> |
#include <mm/as.h> |
#include <mm/heap.h> |
#include <synch/spinlock.h> |
54,12 → 54,12 |
* |
* Create new task with no threads. |
* |
* @param m Task's virtual memory structure. |
* @param as Task's address space. |
* |
* @return New task's structure on success, NULL on failure. |
* |
*/ |
task_t *task_create(vm_t *m) |
task_t *task_create(as_t *as) |
{ |
ipl_t ipl; |
task_t *ta; |
69,7 → 69,7 |
spinlock_initialize(&ta->lock, "task_ta_lock"); |
list_initialize(&ta->th_head); |
list_initialize(&ta->tasks_link); |
ta->vm = m; |
ta->as = as; |
ipl = interrupts_disable(); |
spinlock_lock(&tasks_lock); |