Subversion Repositories HelenOS

Rev

Rev 3492 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3492 Rev 3742
Line 144... Line 144...
144
    as_slab = slab_cache_create("as_slab", sizeof(as_t), 0,
144
    as_slab = slab_cache_create("as_slab", sizeof(as_t), 0,
145
        as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED);
145
        as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED);
146
   
146
   
147
    AS_KERNEL = as_create(FLAG_AS_KERNEL);
147
    AS_KERNEL = as_create(FLAG_AS_KERNEL);
148
    if (!AS_KERNEL)
148
    if (!AS_KERNEL)
149
        panic("can't create kernel address space\n");
149
        panic("Cannot create kernel address space\n");
150
   
150
   
-
 
151
    /* Make sure the kernel address space
-
 
152
     * reference count never drops to zero.
-
 
153
     */
-
 
154
    atomic_set(&AS_KERNEL->refcount, 1);
151
}
155
}
152
 
156
 
153
/** Create address space.
157
/** Create address space.
154
 *
158
 *
155
 * @param flags     Flags that influence the way in wich the address space
159
 * @param flags     Flags that influence the way in wich the address space
Line 769... Line 773...
769
 * In order for this to work properly, this may copy the data
773
 * In order for this to work properly, this may copy the data
770
 * into private anonymous memory (unless it's already there).
774
 * into private anonymous memory (unless it's already there).
771
 *
775
 *
772
 * @param as        Address space.
776
 * @param as      Address space.
773
 * @param flags     Flags of the area memory.
777
 * @param flags   Flags of the area memory.
774
 * @param address   Address withing the area to be changed.
778
 * @param address Address within the area to be changed.
775
 *
779
 *
776
 * @return      Zero on success or a value from @ref errno.h on failure.
780
 * @return Zero on success or a value from @ref errno.h on failure.
-
 
781
 *
777
 */
782
 */
778
int as_area_change_flags(as_t *as, int flags, uintptr_t address)
783
int as_area_change_flags(as_t *as, int flags, uintptr_t address)
779
{
784
{
780
    as_area_t *area;
785
    as_area_t *area;
781
    uintptr_t base;
786
    uintptr_t base;
Line 797... Line 802...
797
        mutex_unlock(&as->lock);
802
        mutex_unlock(&as->lock);
798
        interrupts_restore(ipl);
803
        interrupts_restore(ipl);
799
        return ENOENT;
804
        return ENOENT;
800
    }
805
    }
801
 
806
 
802
    if (area->sh_info || area->backend != &anon_backend) {
807
    if ((area->sh_info) || (area->backend != &anon_backend)) {
803
        /* Copying shared areas not supported yet */
808
        /* Copying shared areas not supported yet */
804
        /* Copying non-anonymous memory not supported yet */
809
        /* Copying non-anonymous memory not supported yet */
805
        mutex_unlock(&area->lock);
810
        mutex_unlock(&area->lock);
806
        mutex_unlock(&as->lock);
811
        mutex_unlock(&as->lock);
807
        interrupts_restore(ipl);
812
        interrupts_restore(ipl);
Line 868... Line 873...
868
    /*
873
    /*
869
     * Finish TLB shootdown sequence.
874
     * Finish TLB shootdown sequence.
870
     */
875
     */
871
 
876
 
872
    tlb_invalidate_pages(as->asid, area->base, area->pages);
877
    tlb_invalidate_pages(as->asid, area->base, area->pages);
-
 
878
   
873
    /*
879
    /*
874
     * Invalidate potential software translation caches (e.g. TSB on
880
     * Invalidate potential software translation caches (e.g. TSB on
875
     * sparc64).
881
     * sparc64).
876
     */
882
     */
877
    as_invalidate_translation_cache(as, area->base, area->pages);
883
    as_invalidate_translation_cache(as, area->base, area->pages);