Ignore:
File:
1 edited

Legend:

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

    r0ff03f3 r7250d2c  
    9494 *
    9595 * This lock protects:
    96  * - inactive_as_with_asid_head list
     96 * - inactive_as_with_asid_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_head);
     107LIST_INITIALIZE(inactive_as_with_asid_list);
    108108
    109109/** Kernel address space. */
     
    235235        bool cond = true;
    236236        while (cond) {
    237                 ASSERT(!list_empty(&as->as_area_btree.leaf_head));
     237                ASSERT(!list_empty(&as->as_area_btree.leaf_list));
    238238               
    239239                btree_node_t *node =
    240                     list_get_instance(as->as_area_btree.leaf_head.next,
     240                    list_get_instance(list_first(&as->as_area_btree.leaf_list),
    241241                    btree_node_t, leaf_link);
    242242               
     
    602602                bool cond = true;
    603603                while (cond) {
    604                         ASSERT(!list_empty(&area->used_space.leaf_head));
     604                        ASSERT(!list_empty(&area->used_space.leaf_list));
    605605                       
    606606                        btree_node_t *node =
    607                             list_get_instance(area->used_space.leaf_head.prev,
     607                            list_get_instance(list_last(&area->used_space.leaf_list),
    608608                            btree_node_t, leaf_link);
    609609                       
     
    675675               
    676676                /*
    677                  * Invalidate software translation caches (e.g. TSB on sparc64).
     677                 * Invalidate software translation caches
     678                 * (e.g. TSB on sparc64, PHT on ppc32).
    678679                 */
    679680                as_invalidate_translation_cache(as, area->base + P2SZ(pages),
     
    726727        if (--sh_info->refcount == 0) {
    727728                dealloc = true;
    728                 link_t *cur;
    729729               
    730730                /*
     
    732732                 * reference from all frames found there.
    733733                 */
    734                 for (cur = sh_info->pagemap.leaf_head.next;
    735                     cur != &sh_info->pagemap.leaf_head; cur = cur->next) {
     734                list_foreach(sh_info->pagemap.leaf_list, cur) {
    736735                        btree_node_t *node
    737736                            = list_get_instance(cur, btree_node_t, leaf_link);
     
    785784         * Visit only the pages mapped by used_space B+tree.
    786785         */
    787         link_t *cur;
    788         for (cur = area->used_space.leaf_head.next;
    789             cur != &area->used_space.leaf_head; cur = cur->next) {
     786        list_foreach(area->used_space.leaf_list, cur) {
    790787                btree_node_t *node;
    791788                btree_key_t i;
     
    823820       
    824821        /*
    825          * Invalidate potential software translation caches (e.g. TSB on
    826          * sparc64).
     822         * Invalidate potential software translation caches
     823         * (e.g. TSB on sparc64, PHT on ppc32).
    827824         */
    828825        as_invalidate_translation_cache(as, area->base, area->pages);
     
    10641061         */
    10651062        size_t used_pages = 0;
    1066         link_t *cur;
    1067        
    1068         for (cur = area->used_space.leaf_head.next;
    1069             cur != &area->used_space.leaf_head; cur = cur->next) {
     1063       
     1064        list_foreach(area->used_space.leaf_list, cur) {
    10701065                btree_node_t *node
    10711066                    = list_get_instance(cur, btree_node_t, leaf_link);
     
    10931088        size_t frame_idx = 0;
    10941089       
    1095         for (cur = area->used_space.leaf_head.next;
    1096             cur != &area->used_space.leaf_head; cur = cur->next) {
     1090        list_foreach(area->used_space.leaf_list, cur) {
    10971091                btree_node_t *node = list_get_instance(cur, btree_node_t,
    10981092                    leaf_link);
     
    11261120       
    11271121        /*
    1128          * Invalidate potential software translation caches (e.g. TSB on
    1129          * sparc64).
     1122         * Invalidate potential software translation caches
     1123         * (e.g. TSB on sparc64, PHT on ppc32).
    11301124         */
    11311125        as_invalidate_translation_cache(as, area->base, area->pages);
     
    11461140        frame_idx = 0;
    11471141       
    1148         for (cur = area->used_space.leaf_head.next;
    1149             cur != &area->used_space.leaf_head; cur = cur->next) {
     1142        list_foreach(area->used_space.leaf_list, cur) {
    11501143                btree_node_t *node
    11511144                    = list_get_instance(cur, btree_node_t, leaf_link);
     
    12911284 * thing which is forbidden in this context is locking the address space.
    12921285 *
    1293  * When this function is enetered, no spinlocks may be held.
     1286 * When this function is entered, no spinlocks may be held.
    12941287 *
    12951288 * @param old Old address space or NULL.
     
    13331326                       
    13341327                        list_append(&old_as->inactive_as_with_asid_link,
    1335                             &inactive_as_with_asid_head);
     1328                            &inactive_as_with_asid_list);
    13361329                }
    13371330               
     
    20262019       
    20272020        /* Eventually check the addresses behind each area */
    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) {
     2021        list_foreach(AS->as_area_btree.leaf_list, cur) {
     2022                if (ret != 0)
     2023                        break;
     2024
    20322025                btree_node_t *node =
    20332026                    list_get_instance(cur, btree_node_t, leaf_link);
     
    20712064       
    20722065        size_t area_cnt = 0;
    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) {
     2066       
     2067        list_foreach(as->as_area_btree.leaf_list, cur) {
    20772068                btree_node_t *node =
    20782069                    list_get_instance(cur, btree_node_t, leaf_link);
     
    20872078        size_t area_idx = 0;
    20882079       
    2089         for (cur = as->as_area_btree.leaf_head.next;
    2090             cur != &as->as_area_btree.leaf_head; cur = cur->next) {
     2080        list_foreach(as->as_area_btree.leaf_list, cur) {
    20912081                btree_node_t *node =
    20922082                    list_get_instance(cur, btree_node_t, leaf_link);
     
    21242114       
    21252115        /* Print out info about address space areas */
    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) {
     2116        list_foreach(as->as_area_btree.leaf_list, cur) {
    21292117                btree_node_t *node
    21302118                    = list_get_instance(cur, btree_node_t, leaf_link);
Note: See TracChangeset for help on using the changeset viewer.