Changeset 80bcaed in mainline for kernel/generic/src


Ignore:
Timestamp:
2007-02-03T13:22:24Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f619ec11
Parents:
fa8e7d2
Message:

Merge as_t structure into one and leave the differring parts in as_genarch_t.

Indentation and formatting changes in header files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/as.c

    rfa8e7d2 r80bcaed  
    169169        as->cpu_refcount = 0;
    170170#ifdef AS_PAGE_TABLE
    171         as->page_table = page_table_create(flags);
     171        as->genarch.page_table = page_table_create(flags);
    172172#else
    173173        page_table_create(flags);
     
    221221        btree_destroy(&as->as_area_btree);
    222222#ifdef AS_PAGE_TABLE
    223         page_table_destroy(as->page_table);
     223        page_table_destroy(as->genarch.page_table);
    224224#else
    225225        page_table_destroy(NULL);
     
    864864 * @param new New address space.
    865865 */
    866 void as_switch(as_t *old, as_t *replace)
     866void as_switch(as_t *old_as, as_t *new_as)
    867867{
    868868        ipl_t ipl;
     
    875875         * First, take care of the old address space.
    876876         */     
    877         if (old) {
    878                 mutex_lock_active(&old->lock);
    879                 ASSERT(old->cpu_refcount);
    880                 if((--old->cpu_refcount == 0) && (old != AS_KERNEL)) {
     877        if (old_as) {
     878                mutex_lock_active(&old_as->lock);
     879                ASSERT(old_as->cpu_refcount);
     880                if((--old_as->cpu_refcount == 0) && (old_as != AS_KERNEL)) {
    881881                        /*
    882882                         * The old address space is no longer active on
     
    885885                         * ASID.
    886886                         */
    887                          ASSERT(old->asid != ASID_INVALID);
    888                          list_append(&old->inactive_as_with_asid_link,
     887                         ASSERT(old_as->asid != ASID_INVALID);
     888                         list_append(&old_as->inactive_as_with_asid_link,
    889889                             &inactive_as_with_asid_head);
    890890                }
    891                 mutex_unlock(&old->lock);
     891                mutex_unlock(&old_as->lock);
    892892
    893893                /*
     
    895895                 * is being removed from the CPU.
    896896                 */
    897                 as_deinstall_arch(old);
     897                as_deinstall_arch(old_as);
    898898        }
    899899
     
    901901         * Second, prepare the new address space.
    902902         */
    903         mutex_lock_active(&replace->lock);
    904         if ((replace->cpu_refcount++ == 0) && (replace != AS_KERNEL)) {
    905                 if (replace->asid != ASID_INVALID) {
    906                         list_remove(&replace->inactive_as_with_asid_link);
     903        mutex_lock_active(&new_as->lock);
     904        if ((new_as->cpu_refcount++ == 0) && (new_as != AS_KERNEL)) {
     905                if (new_as->asid != ASID_INVALID) {
     906                        list_remove(&new_as->inactive_as_with_asid_link);
    907907                } else {
    908908                        /*
    909                          * Defer call to asid_get() until replace->lock is released.
     909                         * Defer call to asid_get() until new_as->lock is released.
    910910                         */
    911911                        needs_asid = true;
    912912                }
    913913        }
    914         SET_PTL0_ADDRESS(replace->page_table);
    915         mutex_unlock(&replace->lock);
     914#ifdef AS_PAGE_TABLE
     915        SET_PTL0_ADDRESS(new_as->genarch.page_table);
     916#endif
     917        mutex_unlock(&new_as->lock);
    916918
    917919        if (needs_asid) {
     
    923925               
    924926                asid = asid_get();
    925                 mutex_lock_active(&replace->lock);
    926                 replace->asid = asid;
    927                 mutex_unlock(&replace->lock);
     927                mutex_lock_active(&new_as->lock);
     928                new_as->asid = asid;
     929                mutex_unlock(&new_as->lock);
    928930        }
    929931        spinlock_unlock(&inactive_as_with_asid_lock);
     
    934936         * (e.g. write ASID to hardware register etc.)
    935937         */
    936         as_install_arch(replace);
    937        
    938         AS = replace;
     938        as_install_arch(new_as);
     939       
     940        AS = new_as;
    939941}
    940942
Note: See TracChangeset for help on using the changeset viewer.