Ignore:
File:
1 edited

Legend:

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

    r7250d2c r0ff03f3  
    9494 *
    9595 * This lock protects:
    96  * - inactive_as_with_asid_list
     96 * - inactive_as_with_asid_head list
    9797 * - as->asid for each as of the as_t type
    9898 * - asids_allocated counter
     
    105105 * that have valid ASID.
    106106 */
    107 LIST_INITIALIZE(inactive_as_with_asid_list);
     107LIST_INITIALIZE(inactive_as_with_asid_head);
    108108
    109109/** Kernel address space. */
     
    235235        bool cond = true;
    236236        while (cond) {
    237                 ASSERT(!list_empty(&as->as_area_btree.leaf_list));
     237                ASSERT(!list_empty(&as->as_area_btree.leaf_head));
    238238               
    239239                btree_node_t *node =
    240                     list_get_instance(list_first(&as->as_area_btree.leaf_list),
     240                    list_get_instance(as->as_area_btree.leaf_head.next,
    241241                    btree_node_t, leaf_link);
    242242               
     
    602602                bool cond = true;
    603603                while (cond) {
    604                         ASSERT(!list_empty(&area->used_space.leaf_list));
     604                        ASSERT(!list_empty(&area->used_space.leaf_head));
    605605                       
    606606                        btree_node_t *node =
    607                             list_get_instance(list_last(&area->used_space.leaf_list),
     607                            list_get_instance(area->used_space.leaf_head.prev,
    608608                            btree_node_t, leaf_link);
    609609                       
     
    675675               
    676676                /*
    677                  * Invalidate software translation caches
    678                  * (e.g. TSB on sparc64, PHT on ppc32).
     677                 * Invalidate software translation caches (e.g. TSB on sparc64).
    679678                 */
    680679                as_invalidate_translation_cache(as, area->base + P2SZ(pages),
     
    727726        if (--sh_info->refcount == 0) {
    728727                dealloc = true;
     728                link_t *cur;
    729729               
    730730                /*
     
    732732                 * reference from all frames found there.
    733733                 */
    734                 list_foreach(sh_info->pagemap.leaf_list, cur) {
     734                for (cur = sh_info->pagemap.leaf_head.next;
     735                    cur != &sh_info->pagemap.leaf_head; cur = cur->next) {
    735736                        btree_node_t *node
    736737                            = list_get_instance(cur, btree_node_t, leaf_link);
     
    784785         * Visit only the pages mapped by used_space B+tree.
    785786         */
    786         list_foreach(area->used_space.leaf_list, cur) {
     787        link_t *cur;
     788        for (cur = area->used_space.leaf_head.next;
     789            cur != &area->used_space.leaf_head; cur = cur->next) {
    787790                btree_node_t *node;
    788791                btree_key_t i;
     
    820823       
    821824        /*
    822          * Invalidate potential software translation caches
    823          * (e.g. TSB on sparc64, PHT on ppc32).
     825         * Invalidate potential software translation caches (e.g. TSB on
     826         * sparc64).
    824827         */
    825828        as_invalidate_translation_cache(as, area->base, area->pages);
     
    10611064         */
    10621065        size_t used_pages = 0;
    1063        
    1064         list_foreach(area->used_space.leaf_list, cur) {
     1066        link_t *cur;
     1067       
     1068        for (cur = area->used_space.leaf_head.next;
     1069            cur != &area->used_space.leaf_head; cur = cur->next) {
    10651070                btree_node_t *node
    10661071                    = list_get_instance(cur, btree_node_t, leaf_link);
     
    10881093        size_t frame_idx = 0;
    10891094       
    1090         list_foreach(area->used_space.leaf_list, cur) {
     1095        for (cur = area->used_space.leaf_head.next;
     1096            cur != &area->used_space.leaf_head; cur = cur->next) {
    10911097                btree_node_t *node = list_get_instance(cur, btree_node_t,
    10921098                    leaf_link);
     
    11201126       
    11211127        /*
    1122          * Invalidate potential software translation caches
    1123          * (e.g. TSB on sparc64, PHT on ppc32).
     1128         * Invalidate potential software translation caches (e.g. TSB on
     1129         * sparc64).
    11241130         */
    11251131        as_invalidate_translation_cache(as, area->base, area->pages);
     
    11401146        frame_idx = 0;
    11411147       
    1142         list_foreach(area->used_space.leaf_list, cur) {
     1148        for (cur = area->used_space.leaf_head.next;
     1149            cur != &area->used_space.leaf_head; cur = cur->next) {
    11431150                btree_node_t *node
    11441151                    = list_get_instance(cur, btree_node_t, leaf_link);
     
    12841291 * thing which is forbidden in this context is locking the address space.
    12851292 *
    1286  * When this function is entered, no spinlocks may be held.
     1293 * When this function is enetered, no spinlocks may be held.
    12871294 *
    12881295 * @param old Old address space or NULL.
     
    13261333                       
    13271334                        list_append(&old_as->inactive_as_with_asid_link,
    1328                             &inactive_as_with_asid_list);
     1335                            &inactive_as_with_asid_head);
    13291336                }
    13301337               
     
    20192026       
    20202027        /* Eventually check the addresses behind each area */
    2021         list_foreach(AS->as_area_btree.leaf_list, cur) {
    2022                 if (ret != 0)
    2023                         break;
    2024 
     2028        link_t *cur;
     2029        for (cur = AS->as_area_btree.leaf_head.next;
     2030            (ret == 0) && (cur != &AS->as_area_btree.leaf_head);
     2031            cur = cur->next) {
    20252032                btree_node_t *node =
    20262033                    list_get_instance(cur, btree_node_t, leaf_link);
     
    20642071       
    20652072        size_t area_cnt = 0;
    2066        
    2067         list_foreach(as->as_area_btree.leaf_list, cur) {
     2073        link_t *cur;
     2074       
     2075        for (cur = as->as_area_btree.leaf_head.next;
     2076            cur != &as->as_area_btree.leaf_head; cur = cur->next) {
    20682077                btree_node_t *node =
    20692078                    list_get_instance(cur, btree_node_t, leaf_link);
     
    20782087        size_t area_idx = 0;
    20792088       
    2080         list_foreach(as->as_area_btree.leaf_list, cur) {
     2089        for (cur = as->as_area_btree.leaf_head.next;
     2090            cur != &as->as_area_btree.leaf_head; cur = cur->next) {
    20812091                btree_node_t *node =
    20822092                    list_get_instance(cur, btree_node_t, leaf_link);
     
    21142124       
    21152125        /* Print out info about address space areas */
    2116         list_foreach(as->as_area_btree.leaf_list, cur) {
     2126        link_t *cur;
     2127        for (cur = as->as_area_btree.leaf_head.next;
     2128            cur != &as->as_area_btree.leaf_head; cur = cur->next) {
    21172129                btree_node_t *node
    21182130                    = list_get_instance(cur, btree_node_t, leaf_link);
Note: See TracChangeset for help on using the changeset viewer.