Subversion Repositories HelenOS

Rev

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

Rev 2133 Rev 2141
Line 611... Line 611...
611
 *
611
 *
612
 * @return Zero on success or ENOENT if there is no such task or if there is no
612
 * @return Zero on success or ENOENT if there is no such task or if there is no
613
 * such address space area, EPERM if there was a problem in accepting the area
613
 * such address space area, EPERM if there was a problem in accepting the area
614
 * or ENOMEM if there was a problem in allocating destination address space
614
 * or ENOMEM if there was a problem in allocating destination address space
615
 * area. ENOTSUP is returned if the address space area backend does not support
615
 * area. ENOTSUP is returned if the address space area backend does not support
616
 * sharing or if the kernel detects an attempt to create an illegal address
-
 
617
 * alias.
616
 * sharing.
618
 */
617
 */
619
int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
618
int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
620
          as_t *dst_as, uintptr_t dst_base, int dst_flags_mask)
619
          as_t *dst_as, uintptr_t dst_base, int dst_flags_mask)
621
{
620
{
622
    ipl_t ipl;
621
    ipl_t ipl;
Line 665... Line 664...
665
        mutex_unlock(&src_as->lock);
664
        mutex_unlock(&src_as->lock);
666
        interrupts_restore(ipl);
665
        interrupts_restore(ipl);
667
        return EPERM;
666
        return EPERM;
668
    }
667
    }
669
 
668
 
670
#ifdef CONFIG_VIRT_IDX_DCACHE
-
 
671
    if (!(dst_flags_mask & AS_AREA_EXEC)) {
-
 
672
        if (PAGE_COLOR(src_area->base) != PAGE_COLOR(dst_base)) {
-
 
673
            /*
-
 
674
             * Refuse to create an illegal address alias.
-
 
675
             */
-
 
676
            mutex_unlock(&src_area->lock);
-
 
677
            mutex_unlock(&src_as->lock);
-
 
678
            interrupts_restore(ipl);
-
 
679
            return ENOTSUP;
-
 
680
        }
-
 
681
    }
-
 
682
#endif /* CONFIG_VIRT_IDX_DCACHE */
-
 
683
 
-
 
684
    /*
669
    /*
685
     * Now we are committed to sharing the area.
670
     * Now we are committed to sharing the area.
686
     * First, prepare the area for sharing.
671
     * First, prepare the area for sharing.
687
     * Then it will be safe to unlock it.
672
     * Then it will be safe to unlock it.
688
     */
673
     */
Line 899... Line 884...
899
             * The old address space is no longer active on
884
             * The old address space is no longer active on
900
             * any processor. It can be appended to the
885
             * any processor. It can be appended to the
901
             * list of inactive address spaces with assigned
886
             * list of inactive address spaces with assigned
902
             * ASID.
887
             * ASID.
903
             */
888
             */
904
             ASSERT(old_as->asid != ASID_INVALID);
889
            ASSERT(old_as->asid != ASID_INVALID);
905
             list_append(&old_as->inactive_as_with_asid_link,
890
            list_append(&old_as->inactive_as_with_asid_link,
906
                 &inactive_as_with_asid_head);
891
                &inactive_as_with_asid_head);
907
        }
892
        }
908
        mutex_unlock(&old_as->lock);
893
        mutex_unlock(&old_as->lock);
909
 
894
 
910
        /*
895
        /*
911
         * Perform architecture-specific tasks when the address space
896
         * Perform architecture-specific tasks when the address space