Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1890 → Rev 1891

/trunk/kernel/generic/include/mm/as.h
160,8 → 160,6
 
/** Data to be used by the backend. */
mem_backend_data_t backend_data;
as_arch_t arch;
};
 
extern as_t *AS_KERNEL;
190,7 → 188,17
extern int used_space_insert(as_area_t *a, uintptr_t page, count_t count);
extern int used_space_remove(as_area_t *a, uintptr_t page, count_t count);
 
 
/* Interface to be implemented by architectures. */
#ifndef as_constructor_arch
extern int as_constructor_arch(as_t *as, int flags);
#endif /* !def as_constructor_arch */
#ifndef as_destructor_arch
extern int as_destructor_arch(as_t *as);
#endif /* !def as_destructor_arch */
#ifndef as_create_arch
extern int as_create_arch(as_t *as, int flags);
#endif /* !def as_create_arch */
#ifndef as_install_arch
extern void as_install_arch(as_t *as);
#endif /* !def as_install_arch */
/trunk/kernel/generic/src/mm/as.c
106,12 → 106,33
static bool check_area_conflicts(as_t *as, uintptr_t va, size_t size, as_area_t *avoid_area);
static void sh_info_remove_reference(share_info_t *sh_info);
 
static int as_constructor(void *obj, int flags)
{
as_t *as = (as_t *) obj;
int rc;
 
link_initialize(&as->inactive_as_with_asid_link);
mutex_initialize(&as->lock);
rc = as_constructor_arch(as, flags);
return rc;
}
 
static int as_destructor(void *obj)
{
as_t *as = (as_t *) obj;
 
return as_destructor_arch(as);
}
 
/** Initialize address space subsystem. */
void as_init(void)
{
as_arch_init();
as_slab = slab_cache_create("as_slab", sizeof(as_t), 0, NULL, NULL, SLAB_CACHE_MAGDEFERRED);
as_slab = slab_cache_create("as_slab", sizeof(as_t), 0,
as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED);
AS_KERNEL = as_create(FLAG_AS_KERNEL);
if (!AS_KERNEL)
128,8 → 149,8
as_t *as;
 
as = (as_t *) slab_alloc(as_slab, 0);
link_initialize(&as->inactive_as_with_asid_link);
mutex_initialize(&as->lock);
(void) as_create_arch(as, 0);
btree_create(&as->as_area_btree);
if (flags & FLAG_AS_KERNEL)