Subversion Repositories HelenOS-historic

Rev

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

Rev 814 Rev 822
Line 76... Line 76...
76
 */
76
 */
77
as_t *as_create(int flags)
77
as_t *as_create(int flags)
78
{
78
{
79
    as_t *as;
79
    as_t *as;
80
 
80
 
81
    as = (as_t *) malloc(sizeof(as_t));
81
    as = (as_t *) malloc(sizeof(as_t), 0);
82
    if (as) {
-
 
83
        list_initialize(&as->as_with_asid_link);
-
 
84
        spinlock_initialize(&as->lock, "as_lock");
-
 
85
        list_initialize(&as->as_area_head);
-
 
86
 
-
 
87
        if (flags & FLAG_AS_KERNEL)
-
 
88
            as->asid = ASID_KERNEL;
-
 
89
        else
-
 
90
            as->asid = ASID_INVALID;
-
 
91
 
82
 
-
 
83
    list_initialize(&as->as_with_asid_link);
-
 
84
    spinlock_initialize(&as->lock, "as_lock");
92
        as->page_table = page_table_create(flags);
85
    list_initialize(&as->as_area_head);
-
 
86
   
-
 
87
    if (flags & FLAG_AS_KERNEL)
-
 
88
        as->asid = ASID_KERNEL;
-
 
89
    else
-
 
90
        as->asid = ASID_INVALID;
93
    }
91
   
-
 
92
    as->page_table = page_table_create(flags);
94
 
93
 
95
    return as;
94
    return as;
96
}
95
}
97
 
96
 
98
/** Create address space area of common attributes.
97
/** Create address space area of common attributes.
Line 119... Line 118...
119
   
118
   
120
    /*
119
    /*
121
     * TODO: test as_area which is to be created doesn't overlap with an existing one.
120
     * TODO: test as_area which is to be created doesn't overlap with an existing one.
122
     */
121
     */
123
   
122
   
124
    a = (as_area_t *) malloc(sizeof(as_area_t));
123
    a = (as_area_t *) malloc(sizeof(as_area_t), 0);
125
    if (a) {   
124
 
126
        spinlock_initialize(&a->lock, "as_area_lock");
125
    spinlock_initialize(&a->lock, "as_area_lock");
127
           
126
   
128
        link_initialize(&a->link);         
127
    link_initialize(&a->link);         
129
        a->type = type;
128
    a->type = type;
130
        a->size = size;
129
    a->size = size;
131
        a->base = base;
130
    a->base = base;
132
       
131
   
133
        list_append(&a->link, &as->as_area_head);
132
    list_append(&a->link, &as->as_area_head);
134
    }
-
 
135
 
133
 
136
    spinlock_unlock(&as->lock);
134
    spinlock_unlock(&as->lock);
137
    interrupts_restore(ipl);
135
    interrupts_restore(ipl);
138
 
136
 
139
    return a;
137
    return a;