Subversion Repositories HelenOS

Rev

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

Rev 1890 Rev 1891
Line 104... Line 104...
104
static int area_flags_to_page_flags(int aflags);
104
static int area_flags_to_page_flags(int aflags);
105
static as_area_t *find_area_and_lock(as_t *as, uintptr_t va);
105
static as_area_t *find_area_and_lock(as_t *as, uintptr_t va);
106
static bool check_area_conflicts(as_t *as, uintptr_t va, size_t size, as_area_t *avoid_area);
106
static bool check_area_conflicts(as_t *as, uintptr_t va, size_t size, as_area_t *avoid_area);
107
static void sh_info_remove_reference(share_info_t *sh_info);
107
static void sh_info_remove_reference(share_info_t *sh_info);
108
 
108
 
-
 
109
static int as_constructor(void *obj, int flags)
-
 
110
{
-
 
111
    as_t *as = (as_t *) obj;
-
 
112
    int rc;
-
 
113
 
-
 
114
    link_initialize(&as->inactive_as_with_asid_link);
-
 
115
    mutex_initialize(&as->lock);   
-
 
116
   
-
 
117
    rc = as_constructor_arch(as, flags);
-
 
118
   
-
 
119
    return rc;
-
 
120
}
-
 
121
 
-
 
122
static int as_destructor(void *obj)
-
 
123
{
-
 
124
    as_t *as = (as_t *) obj;
-
 
125
 
-
 
126
    return as_destructor_arch(as);
-
 
127
}
-
 
128
 
109
/** Initialize address space subsystem. */
129
/** Initialize address space subsystem. */
110
void as_init(void)
130
void as_init(void)
111
{
131
{
112
    as_arch_init();
132
    as_arch_init();
113
   
133
   
114
    as_slab = slab_cache_create("as_slab", sizeof(as_t), 0, NULL, NULL, SLAB_CACHE_MAGDEFERRED);
134
    as_slab = slab_cache_create("as_slab", sizeof(as_t), 0,
-
 
135
        as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED);
115
   
136
   
116
    AS_KERNEL = as_create(FLAG_AS_KERNEL);
137
    AS_KERNEL = as_create(FLAG_AS_KERNEL);
117
    if (!AS_KERNEL)
138
    if (!AS_KERNEL)
118
        panic("can't create kernel address space\n");
139
        panic("can't create kernel address space\n");
119
   
140
   
Line 126... Line 147...
126
as_t *as_create(int flags)
147
as_t *as_create(int flags)
127
{
148
{
128
    as_t *as;
149
    as_t *as;
129
 
150
 
130
    as = (as_t *) slab_alloc(as_slab, 0);
151
    as = (as_t *) slab_alloc(as_slab, 0);
131
    link_initialize(&as->inactive_as_with_asid_link);
-
 
132
    mutex_initialize(&as->lock);
152
    (void) as_create_arch(as, 0);
-
 
153
   
133
    btree_create(&as->as_area_btree);
154
    btree_create(&as->as_area_btree);
134
   
155
   
135
    if (flags & FLAG_AS_KERNEL)
156
    if (flags & FLAG_AS_KERNEL)
136
        as->asid = ASID_KERNEL;
157
        as->asid = ASID_KERNEL;
137
    else
158
    else