Ignore:
File:
1 edited

Legend:

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

    r7250d2c reef1b031  
    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                       
     
    727727        if (--sh_info->refcount == 0) {
    728728                dealloc = true;
     729                link_t *cur;
    729730               
    730731                /*
     
    732733                 * reference from all frames found there.
    733734                 */
    734                 list_foreach(sh_info->pagemap.leaf_list, cur) {
     735                for (cur = sh_info->pagemap.leaf_head.next;
     736                    cur != &sh_info->pagemap.leaf_head; cur = cur->next) {
    735737                        btree_node_t *node
    736738                            = list_get_instance(cur, btree_node_t, leaf_link);
     
    784786         * Visit only the pages mapped by used_space B+tree.
    785787         */
    786         list_foreach(area->used_space.leaf_list, cur) {
     788        link_t *cur;
     789        for (cur = area->used_space.leaf_head.next;
     790            cur != &area->used_space.leaf_head; cur = cur->next) {
    787791                btree_node_t *node;
    788792                btree_key_t i;
     
    10611065         */
    10621066        size_t used_pages = 0;
    1063        
    1064         list_foreach(area->used_space.leaf_list, cur) {
     1067        link_t *cur;
     1068       
     1069        for (cur = area->used_space.leaf_head.next;
     1070            cur != &area->used_space.leaf_head; cur = cur->next) {
    10651071                btree_node_t *node
    10661072                    = list_get_instance(cur, btree_node_t, leaf_link);
     
    10881094        size_t frame_idx = 0;
    10891095       
    1090         list_foreach(area->used_space.leaf_list, cur) {
     1096        for (cur = area->used_space.leaf_head.next;
     1097            cur != &area->used_space.leaf_head; cur = cur->next) {
    10911098                btree_node_t *node = list_get_instance(cur, btree_node_t,
    10921099                    leaf_link);
     
    11401147        frame_idx = 0;
    11411148       
    1142         list_foreach(area->used_space.leaf_list, cur) {
     1149        for (cur = area->used_space.leaf_head.next;
     1150            cur != &area->used_space.leaf_head; cur = cur->next) {
    11431151                btree_node_t *node
    11441152                    = list_get_instance(cur, btree_node_t, leaf_link);
     
    12841292 * thing which is forbidden in this context is locking the address space.
    12851293 *
    1286  * When this function is entered, no spinlocks may be held.
     1294 * When this function is enetered, no spinlocks may be held.
    12871295 *
    12881296 * @param old Old address space or NULL.
     
    13261334                       
    13271335                        list_append(&old_as->inactive_as_with_asid_link,
    1328                             &inactive_as_with_asid_list);
     1336                            &inactive_as_with_asid_head);
    13291337                }
    13301338               
     
    20192027       
    20202028        /* Eventually check the addresses behind each area */
    2021         list_foreach(AS->as_area_btree.leaf_list, cur) {
    2022                 if (ret != 0)
    2023                         break;
    2024 
     2029        link_t *cur;
     2030        for (cur = AS->as_area_btree.leaf_head.next;
     2031            (ret == 0) && (cur != &AS->as_area_btree.leaf_head);
     2032            cur = cur->next) {
    20252033                btree_node_t *node =
    20262034                    list_get_instance(cur, btree_node_t, leaf_link);
     
    20642072       
    20652073        size_t area_cnt = 0;
    2066        
    2067         list_foreach(as->as_area_btree.leaf_list, cur) {
     2074        link_t *cur;
     2075       
     2076        for (cur = as->as_area_btree.leaf_head.next;
     2077            cur != &as->as_area_btree.leaf_head; cur = cur->next) {
    20682078                btree_node_t *node =
    20692079                    list_get_instance(cur, btree_node_t, leaf_link);
     
    20782088        size_t area_idx = 0;
    20792089       
    2080         list_foreach(as->as_area_btree.leaf_list, cur) {
     2090        for (cur = as->as_area_btree.leaf_head.next;
     2091            cur != &as->as_area_btree.leaf_head; cur = cur->next) {
    20812092                btree_node_t *node =
    20822093                    list_get_instance(cur, btree_node_t, leaf_link);
     
    21142125       
    21152126        /* Print out info about address space areas */
    2116         list_foreach(as->as_area_btree.leaf_list, cur) {
     2127        link_t *cur;
     2128        for (cur = as->as_area_btree.leaf_head.next;
     2129            cur != &as->as_area_btree.leaf_head; cur = cur->next) {
    21172130                btree_node_t *node
    21182131                    = list_get_instance(cur, btree_node_t, leaf_link);
Note: See TracChangeset for help on using the changeset viewer.