Subversion Repositories HelenOS

Rev

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

Rev 2556 Rev 2647
Line 638... Line 638...
638
 * or ENOMEM if there was a problem in allocating destination address space
638
 * or ENOMEM if there was a problem in allocating destination address space
639
 * area. ENOTSUP is returned if the address space area backend does not support
639
 * area. ENOTSUP is returned if the address space area backend does not support
640
 * sharing.
640
 * sharing.
641
 */
641
 */
642
int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
642
int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
643
          as_t *dst_as, uintptr_t dst_base, int dst_flags_mask)
643
    as_t *dst_as, uintptr_t dst_base, int dst_flags_mask)
644
{
644
{
645
    ipl_t ipl;
645
    ipl_t ipl;
646
    int src_flags;
646
    int src_flags;
647
    size_t src_size;
647
    size_t src_size;
648
    as_area_t *src_area, *dst_area;
648
    as_area_t *src_area, *dst_area;
Line 700... Line 700...
700
        sh_info = (share_info_t *) malloc(sizeof(share_info_t), 0);
700
        sh_info = (share_info_t *) malloc(sizeof(share_info_t), 0);
701
        mutex_initialize(&sh_info->lock);
701
        mutex_initialize(&sh_info->lock);
702
        sh_info->refcount = 2;
702
        sh_info->refcount = 2;
703
        btree_create(&sh_info->pagemap);
703
        btree_create(&sh_info->pagemap);
704
        src_area->sh_info = sh_info;
704
        src_area->sh_info = sh_info;
-
 
705
        /*
-
 
706
         * Call the backend to setup sharing.
-
 
707
         */
-
 
708
        src_area->backend->share(src_area);
705
    } else {
709
    } else {
706
        mutex_lock(&sh_info->lock);
710
        mutex_lock(&sh_info->lock);
707
        sh_info->refcount++;
711
        sh_info->refcount++;
708
        mutex_unlock(&sh_info->lock);
712
        mutex_unlock(&sh_info->lock);
709
    }
713
    }
710
 
714
 
711
    src_area->backend->share(src_area);
-
 
712
 
-
 
713
    mutex_unlock(&src_area->lock);
715
    mutex_unlock(&src_area->lock);
714
    mutex_unlock(&src_as->lock);
716
    mutex_unlock(&src_as->lock);
715
 
717
 
716
    /*
718
    /*
717
     * Create copy of the source address space area.
719
     * Create copy of the source address space area.