Subversion Repositories HelenOS

Rev

Rev 624 | Rev 788 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 624 Rev 703
Line 26... Line 26...
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
#include <proc/thread.h>
29
#include <proc/thread.h>
30
#include <proc/task.h>
30
#include <proc/task.h>
31
#include <mm/vm.h>
31
#include <mm/as.h>
32
#include <mm/heap.h>
32
#include <mm/heap.h>
33
 
33
 
34
#include <synch/spinlock.h>
34
#include <synch/spinlock.h>
35
#include <arch.h>
35
#include <arch.h>
36
#include <panic.h>
36
#include <panic.h>
Line 52... Line 52...
52
 
52
 
53
/** Create new task
53
/** Create new task
54
 *
54
 *
55
 * Create new task with no threads.
55
 * Create new task with no threads.
56
 *
56
 *
57
 * @param m Task's virtual memory structure.
57
 * @param as Task's address space.
58
 *
58
 *
59
 * @return New task's structure on success, NULL on failure.
59
 * @return New task's structure on success, NULL on failure.
60
 *
60
 *
61
 */
61
 */
62
task_t *task_create(vm_t *m)
62
task_t *task_create(as_t *as)
63
{
63
{
64
    ipl_t ipl;
64
    ipl_t ipl;
65
    task_t *ta;
65
    task_t *ta;
66
   
66
   
67
    ta = (task_t *) malloc(sizeof(task_t));
67
    ta = (task_t *) malloc(sizeof(task_t));
68
    if (ta) {
68
    if (ta) {
69
        spinlock_initialize(&ta->lock, "task_ta_lock");
69
        spinlock_initialize(&ta->lock, "task_ta_lock");
70
        list_initialize(&ta->th_head);
70
        list_initialize(&ta->th_head);
71
        list_initialize(&ta->tasks_link);
71
        list_initialize(&ta->tasks_link);
72
        ta->vm = m;
72
        ta->as = as;
73
       
73
       
74
        ipl = interrupts_disable();
74
        ipl = interrupts_disable();
75
        spinlock_lock(&tasks_lock);
75
        spinlock_lock(&tasks_lock);
76
        list_append(&ta->tasks_link, &tasks_head);
76
        list_append(&ta->tasks_link, &tasks_head);
77
        spinlock_unlock(&tasks_lock);
77
        spinlock_unlock(&tasks_lock);