Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2014 → Rev 2015

/trunk/kernel/generic/src/mm/as.c
166,11 → 166,6
as->cpu_refcount = 0;
as->page_table = page_table_create(flags);
 
#ifdef CONFIG_VIRT_IDX_DCACHE
as->dcache_flush_on_install = false;
as->dcache_flush_on_deinstall = false;
#endif /* CONFIG_VIRT_IDX_DCACHE */
 
return as;
}
 
278,18 → 273,6
else
memsetb((uintptr_t) &a->backend_data, sizeof(a->backend_data), 0);
 
#ifdef CONFIG_VIRT_IDX_DCACHE
/*
* When the area is being created with the AS_AREA_ATTR_PARTIAL flag, the
* orig_color is probably wrong until the flag is reset. In other words, it is
* initialized with the color of the area being created and not with the color
* of the original address space area at the beginning of the share chain. Of
* course, the correct color is set by as_area_share() before the flag is
* reset.
*/
a->orig_color = PAGE_COLOR(base);
#endif /* CONFIG_VIRT_IDX_DCACHE */
 
btree_create(&a->used_space);
btree_insert(&as->as_area_btree, base, (void *) a, NULL);
575,7 → 558,8
* such address space area, EPERM if there was a problem in accepting the area
* or ENOMEM if there was a problem in allocating destination address space
* area. ENOTSUP is returned if the address space area backend does not support
* sharing.
* sharing or if the kernel detects an attempt to create an illegal address
* alias.
*/
int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
as_t *dst_as, uintptr_t dst_base, int dst_flags_mask)
583,7 → 567,6
ipl_t ipl;
int src_flags;
size_t src_size;
int src_orig_color;
as_area_t *src_area, *dst_area;
share_info_t *sh_info;
mem_backend_t *src_backend;
600,7 → 583,6
interrupts_restore(ipl);
return ENOENT;
}
 
if (!src_area->backend || !src_area->backend->share) {
/*
617,7 → 599,6
src_flags = src_area->flags;
src_backend = src_area->backend;
src_backend_data = src_area->backend_data;
src_orig_color = src_area->orig_color;
 
/* Share the cacheable flag from the original mapping */
if (src_flags & AS_AREA_CACHEABLE)
630,6 → 611,20
return EPERM;
}
 
#ifdef CONFIG_VIRT_IDX_DCACHE
if (!(dst_flags_mask & AS_AREA_EXEC)) {
if (PAGE_COLOR(src_area->base) != PAGE_COLOR(dst_base)) {
/*
* Refuse to create an illegal address alias.
*/
mutex_unlock(&src_area->lock);
mutex_unlock(&src_as->lock);
interrupts_restore(ipl);
return ENOTSUP;
}
}
#endif /* CONFIG_VIRT_IDX_DCACHE */
 
/*
* Now we are committed to sharing the area.
* First, prepare the area for sharing.
682,26 → 677,6
mutex_lock(&dst_area->lock);
dst_area->attributes &= ~AS_AREA_ATTR_PARTIAL;
dst_area->sh_info = sh_info;
dst_area->orig_color = src_orig_color;
#ifdef CONFIG_VIRT_IDX_DCACHE
if (src_orig_color != PAGE_COLOR(dst_base)) {
/*
* We have just detected an attempt to create an invalid address
* alias. We allow this and set a special flag that tells the
* architecture specific code to flush the D-cache when the
* offending address space is installed and deinstalled
* (cleanup).
*
* In order for the flags to take effect immediately, we also
* perform a global D-cache shootdown.
*/
dcache_shootdown_start();
dst_as->dcache_flush_on_install = true;
dst_as->dcache_flush_on_deinstall = true;
dcache_flush();
dcache_shootdown_finalize();
}
#endif /* CONFIG_VIRT_IDX_DCACHE */
mutex_unlock(&dst_area->lock);
mutex_unlock(&dst_as->lock);