Changeset 80bcaed in mainline for kernel/generic/src
- Timestamp:
- 2007-02-03T13:22:24Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f619ec11
- Parents:
- fa8e7d2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/as.c
rfa8e7d2 r80bcaed 169 169 as->cpu_refcount = 0; 170 170 #ifdef AS_PAGE_TABLE 171 as-> page_table = page_table_create(flags);171 as->genarch.page_table = page_table_create(flags); 172 172 #else 173 173 page_table_create(flags); … … 221 221 btree_destroy(&as->as_area_btree); 222 222 #ifdef AS_PAGE_TABLE 223 page_table_destroy(as-> page_table);223 page_table_destroy(as->genarch.page_table); 224 224 #else 225 225 page_table_destroy(NULL); … … 864 864 * @param new New address space. 865 865 */ 866 void as_switch(as_t *old , as_t *replace)866 void as_switch(as_t *old_as, as_t *new_as) 867 867 { 868 868 ipl_t ipl; … … 875 875 * First, take care of the old address space. 876 876 */ 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)) { 881 881 /* 882 882 * The old address space is no longer active on … … 885 885 * ASID. 886 886 */ 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, 889 889 &inactive_as_with_asid_head); 890 890 } 891 mutex_unlock(&old ->lock);891 mutex_unlock(&old_as->lock); 892 892 893 893 /* … … 895 895 * is being removed from the CPU. 896 896 */ 897 as_deinstall_arch(old );897 as_deinstall_arch(old_as); 898 898 } 899 899 … … 901 901 * Second, prepare the new address space. 902 902 */ 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); 907 907 } else { 908 908 /* 909 * Defer call to asid_get() until replace->lock is released.909 * Defer call to asid_get() until new_as->lock is released. 910 910 */ 911 911 needs_asid = true; 912 912 } 913 913 } 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); 916 918 917 919 if (needs_asid) { … … 923 925 924 926 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); 928 930 } 929 931 spinlock_unlock(&inactive_as_with_asid_lock); … … 934 936 * (e.g. write ASID to hardware register etc.) 935 937 */ 936 as_install_arch( replace);937 938 AS = replace;938 as_install_arch(new_as); 939 940 AS = new_as; 939 941 } 940 942
Note:
See TracChangeset
for help on using the changeset viewer.