Changeset df3c6f02 in mainline for kernel/generic/src/mm/as.c


Ignore:
Timestamp:
2011-05-31T22:58:56Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d362410
Parents:
82582e4 (diff), 4ce90544 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r82582e4 rdf3c6f02  
    8080#include <arch/interrupt.h>
    8181
    82 #ifdef CONFIG_VIRT_IDX_DCACHE
    83 #include <arch/mm/cache.h>
    84 #endif /* CONFIG_VIRT_IDX_DCACHE */
    85 
    8682/**
    8783 * Each architecture decides what functions will be used to carry out
     
    306302         * We don't want any area to have conflicts with NULL page.
    307303         */
    308         if (overlaps(addr, count << PAGE_WIDTH, (uintptr_t) NULL, PAGE_SIZE))
     304        if (overlaps(addr, P2SZ(count), (uintptr_t) NULL, PAGE_SIZE))
    309305                return false;
    310306       
     
    333329                        mutex_lock(&area->lock);
    334330                       
    335                         if (overlaps(addr, count << PAGE_WIDTH,
    336                             area->base, area->pages << PAGE_WIDTH)) {
     331                        if (overlaps(addr, P2SZ(count), area->base,
     332                            P2SZ(area->pages))) {
    337333                                mutex_unlock(&area->lock);
    338334                                return false;
     
    350346                        mutex_lock(&area->lock);
    351347                       
    352                         if (overlaps(addr, count << PAGE_WIDTH,
    353                             area->base, area->pages << PAGE_WIDTH)) {
     348                        if (overlaps(addr, P2SZ(count), area->base,
     349                            P2SZ(area->pages))) {
    354350                                mutex_unlock(&area->lock);
    355351                                return false;
     
    370366                mutex_lock(&area->lock);
    371367               
    372                 if (overlaps(addr, count << PAGE_WIDTH,
    373                     area->base, area->pages << PAGE_WIDTH)) {
     368                if (overlaps(addr, P2SZ(count), area->base,
     369                    P2SZ(area->pages))) {
    374370                        mutex_unlock(&area->lock);
    375371                        return false;
     
    384380         */
    385381        if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
    386                 return !overlaps(addr, count << PAGE_WIDTH,
    387                     KERNEL_ADDRESS_SPACE_START,
     382                return !overlaps(addr, P2SZ(count), KERNEL_ADDRESS_SPACE_START,
    388383                    KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START);
    389384        }
     
    448443                memsetb(&area->backend_data, sizeof(area->backend_data), 0);
    449444       
     445        if (area->backend && area->backend->create) {
     446                if (!area->backend->create(area)) {
     447                        free(area);
     448                        mutex_unlock(&as->lock);
     449                        return NULL;
     450                }
     451        }
     452       
    450453        btree_create(&area->used_space);
    451454        btree_insert(&as->as_area_btree, base, (void *) area, NULL);
     
    470473       
    471474        btree_node_t *leaf;
    472         as_area_t *area = (as_area_t *) btree_search(&as->as_area_btree, va, &leaf);
     475        as_area_t *area = (as_area_t *) btree_search(&as->as_area_btree, va,
     476            &leaf);
    473477        if (area) {
    474478                /* va is the base address of an address space area */
     
    478482       
    479483        /*
    480          * Search the leaf node and the righmost record of its left neighbour
     484         * Search the leaf node and the rightmost record of its left neighbour
    481485         * to find out whether this is a miss or va belongs to an address
    482486         * space area found there.
     
    490494               
    491495                mutex_lock(&area->lock);
    492                
     496
    493497                if ((area->base <= va) &&
    494                     (va < area->base + (area->pages << PAGE_WIDTH)))
     498                    (va <= area->base + (P2SZ(area->pages) - 1)))
    495499                        return area;
    496500               
     
    502506         * Because of its position in the B+tree, it must have base < va.
    503507         */
    504         btree_node_t *lnode = btree_leaf_node_left_neighbour(&as->as_area_btree, leaf);
     508        btree_node_t *lnode = btree_leaf_node_left_neighbour(&as->as_area_btree,
     509            leaf);
    505510        if (lnode) {
    506511                area = (as_area_t *) lnode->value[lnode->keys - 1];
     
    508513                mutex_lock(&area->lock);
    509514               
    510                 if (va < area->base + (area->pages << PAGE_WIDTH))
     515                if (va <= area->base + (P2SZ(area->pages) - 1))
    511516                        return area;
    512517               
     
    573578       
    574579        if (pages < area->pages) {
    575                 uintptr_t start_free = area->base + (pages << PAGE_WIDTH);
     580                uintptr_t start_free = area->base + P2SZ(pages);
    576581               
    577582                /*
     
    586591                 */
    587592                ipl_t ipl = tlb_shootdown_start(TLB_INVL_PAGES, as->asid,
    588                     area->base + (pages << PAGE_WIDTH), area->pages - pages);
     593                    area->base + P2SZ(pages), area->pages - pages);
    589594               
    590595                /*
     
    609614                                size_t i = 0;
    610615                               
    611                                 if (overlaps(ptr, size << PAGE_WIDTH, area->base,
    612                                     pages << PAGE_WIDTH)) {
     616                                if (overlaps(ptr, P2SZ(size), area->base,
     617                                    P2SZ(pages))) {
    613618                                       
    614                                         if (ptr + (size << PAGE_WIDTH) <= start_free) {
     619                                        if (ptr + P2SZ(size) <= start_free) {
    615620                                                /*
    616621                                                 * The whole interval fits
     
    643648                               
    644649                                for (; i < size; i++) {
    645                                         pte_t *pte = page_mapping_find(as, ptr +
    646                                             (i << PAGE_WIDTH));
     650                                        pte_t *pte = page_mapping_find(as,
     651                                            ptr + P2SZ(i), false);
    647652                                       
    648653                                        ASSERT(pte);
     
    653658                                            (area->backend->frame_free)) {
    654659                                                area->backend->frame_free(area,
    655                                                     ptr + (i << PAGE_WIDTH),
     660                                                    ptr + P2SZ(i),
    656661                                                    PTE_GET_FRAME(pte));
    657662                                        }
    658663                                       
    659                                         page_mapping_remove(as, ptr +
    660                                             (i << PAGE_WIDTH));
     664                                        page_mapping_remove(as, ptr + P2SZ(i));
    661665                                }
    662666                        }
     
    667671                 */
    668672               
    669                 tlb_invalidate_pages(as->asid, area->base + (pages << PAGE_WIDTH),
     673                tlb_invalidate_pages(as->asid, area->base + P2SZ(pages),
    670674                    area->pages - pages);
    671675               
    672676                /*
    673                  * Invalidate software translation caches (e.g. TSB on sparc64).
    674                  */
    675                 as_invalidate_translation_cache(as, area->base +
    676                     (pages << PAGE_WIDTH), area->pages - pages);
     677                 * Invalidate software translation caches
     678                 * (e.g. TSB on sparc64, PHT on ppc32).
     679                 */
     680                as_invalidate_translation_cache(as, area->base + P2SZ(pages),
     681                    area->pages - pages);
    677682                tlb_shootdown_finalize(ipl);
    678683               
     
    687692                        mutex_unlock(&as->lock);
    688693                        return EADDRNOTAVAIL;
     694                }
     695        }
     696       
     697        if (area->backend && area->backend->resize) {
     698                if (!area->backend->resize(area, pages)) {
     699                        mutex_unlock(&area->lock);
     700                        mutex_unlock(&as->lock);
     701                        return ENOMEM;
    689702                }
    690703        }
     
    756769                return ENOENT;
    757770        }
     771
     772        if (area->backend && area->backend->destroy)
     773                area->backend->destroy(area);
    758774       
    759775        uintptr_t base = area->base;
     
    782798                       
    783799                        for (size = 0; size < (size_t) node->value[i]; size++) {
    784                                 pte_t *pte =
    785                                     page_mapping_find(as, ptr + (size << PAGE_WIDTH));
     800                                pte_t *pte = page_mapping_find(as,
     801                                     ptr + P2SZ(size), false);
    786802                               
    787803                                ASSERT(pte);
     
    792808                                    (area->backend->frame_free)) {
    793809                                        area->backend->frame_free(area,
    794                                             ptr + (size << PAGE_WIDTH), PTE_GET_FRAME(pte));
     810                                            ptr + P2SZ(size),
     811                                            PTE_GET_FRAME(pte));
    795812                                }
    796813                               
    797                                 page_mapping_remove(as, ptr + (size << PAGE_WIDTH));
     814                                page_mapping_remove(as, ptr + P2SZ(size));
    798815                        }
    799816                }
     
    807824       
    808825        /*
    809          * Invalidate potential software translation caches (e.g. TSB on
    810          * sparc64).
     826         * Invalidate potential software translation caches
     827         * (e.g. TSB on sparc64, PHT on ppc32).
    811828         */
    812829        as_invalidate_translation_cache(as, area->base, area->pages);
     
    882899        }
    883900       
    884         size_t src_size = src_area->pages << PAGE_WIDTH;
     901        size_t src_size = P2SZ(src_area->pages);
    885902        unsigned int src_flags = src_area->flags;
    886903        mem_backend_t *src_backend = src_area->backend;
     
    10791096        for (cur = area->used_space.leaf_head.next;
    10801097            cur != &area->used_space.leaf_head; cur = cur->next) {
    1081                 btree_node_t *node
    1082                     = list_get_instance(cur, btree_node_t, leaf_link);
     1098                btree_node_t *node = list_get_instance(cur, btree_node_t,
     1099                    leaf_link);
    10831100                btree_key_t i;
    10841101               
     
    10881105                       
    10891106                        for (size = 0; size < (size_t) node->value[i]; size++) {
    1090                                 pte_t *pte =
    1091                                     page_mapping_find(as, ptr + (size << PAGE_WIDTH));
     1107                                pte_t *pte = page_mapping_find(as,
     1108                                    ptr + P2SZ(size), false);
    10921109                               
    10931110                                ASSERT(pte);
     
    10981115                               
    10991116                                /* Remove old mapping */
    1100                                 page_mapping_remove(as, ptr + (size << PAGE_WIDTH));
     1117                                page_mapping_remove(as, ptr + P2SZ(size));
    11011118                        }
    11021119                }
     
    11101127       
    11111128        /*
    1112          * Invalidate potential software translation caches (e.g. TSB on
    1113          * sparc64).
     1129         * Invalidate potential software translation caches
     1130         * (e.g. TSB on sparc64, PHT on ppc32).
    11141131         */
    11151132        as_invalidate_translation_cache(as, area->base, area->pages);
     
    11441161                               
    11451162                                /* Insert the new mapping */
    1146                                 page_mapping_insert(as, ptr + (size << PAGE_WIDTH),
     1163                                page_mapping_insert(as, ptr + P2SZ(size),
    11471164                                    old_frame[frame_idx++], page_flags);
    11481165                               
     
    12251242         */
    12261243        pte_t *pte;
    1227         if ((pte = page_mapping_find(AS, page))) {
     1244        if ((pte = page_mapping_find(AS, page, false))) {
    12281245                if (PTE_PRESENT(pte)) {
    12291246                        if (((access == PF_ACCESS_READ) && PTE_READABLE(pte)) ||
     
    14661483       
    14671484        if (src_area) {
    1468                 size = src_area->pages << PAGE_WIDTH;
     1485                size = P2SZ(src_area->pages);
    14691486                mutex_unlock(&src_area->lock);
    14701487        } else
     
    15211538                if (page >= right_pg) {
    15221539                        /* Do nothing. */
    1523                 } else if (overlaps(page, count << PAGE_WIDTH, left_pg,
    1524                     left_cnt << PAGE_WIDTH)) {
     1540                } else if (overlaps(page, P2SZ(count), left_pg,
     1541                    P2SZ(left_cnt))) {
    15251542                        /* The interval intersects with the left interval. */
    15261543                        return false;
    1527                 } else if (overlaps(page, count << PAGE_WIDTH, right_pg,
    1528                     right_cnt << PAGE_WIDTH)) {
     1544                } else if (overlaps(page, P2SZ(count), right_pg,
     1545                    P2SZ(right_cnt))) {
    15291546                        /* The interval intersects with the right interval. */
    15301547                        return false;
    1531                 } else if ((page == left_pg + (left_cnt << PAGE_WIDTH)) &&
    1532                     (page + (count << PAGE_WIDTH) == right_pg)) {
     1548                } else if ((page == left_pg + P2SZ(left_cnt)) &&
     1549                    (page + P2SZ(count) == right_pg)) {
    15331550                        /*
    15341551                         * The interval can be added by merging the two already
     
    15381555                        btree_remove(&area->used_space, right_pg, leaf);
    15391556                        goto success;
    1540                 } else if (page == left_pg + (left_cnt << PAGE_WIDTH)) {
     1557                } else if (page == left_pg + P2SZ(left_cnt)) {
    15411558                        /*
    15421559                         * The interval can be added by simply growing the left
     
    15451562                        node->value[node->keys - 1] += count;
    15461563                        goto success;
    1547                 } else if (page + (count << PAGE_WIDTH) == right_pg) {
     1564                } else if (page + P2SZ(count) == right_pg) {
    15481565                        /*
    15491566                         * The interval can be addded by simply moving base of
     
    15721589                 */
    15731590               
    1574                 if (overlaps(page, count << PAGE_WIDTH, right_pg,
    1575                     right_cnt << PAGE_WIDTH)) {
     1591                if (overlaps(page, P2SZ(count), right_pg, P2SZ(right_cnt))) {
    15761592                        /* The interval intersects with the right interval. */
    15771593                        return false;
    1578                 } else if (page + (count << PAGE_WIDTH) == right_pg) {
     1594                } else if (page + P2SZ(count) == right_pg) {
    15791595                        /*
    15801596                         * The interval can be added by moving the base of the
     
    16111627                if (page < left_pg) {
    16121628                        /* Do nothing. */
    1613                 } else if (overlaps(page, count << PAGE_WIDTH, left_pg,
    1614                     left_cnt << PAGE_WIDTH)) {
     1629                } else if (overlaps(page, P2SZ(count), left_pg,
     1630                    P2SZ(left_cnt))) {
    16151631                        /* The interval intersects with the left interval. */
    16161632                        return false;
    1617                 } else if (overlaps(page, count << PAGE_WIDTH, right_pg,
    1618                     right_cnt << PAGE_WIDTH)) {
     1633                } else if (overlaps(page, P2SZ(count), right_pg,
     1634                    P2SZ(right_cnt))) {
    16191635                        /* The interval intersects with the right interval. */
    16201636                        return false;
    1621                 } else if ((page == left_pg + (left_cnt << PAGE_WIDTH)) &&
    1622                     (page + (count << PAGE_WIDTH) == right_pg)) {
     1637                } else if ((page == left_pg + P2SZ(left_cnt)) &&
     1638                    (page + P2SZ(count) == right_pg)) {
    16231639                        /*
    16241640                         * The interval can be added by merging the two already
     
    16281644                        btree_remove(&area->used_space, right_pg, node);
    16291645                        goto success;
    1630                 } else if (page == left_pg + (left_cnt << PAGE_WIDTH)) {
     1646                } else if (page == left_pg + P2SZ(left_cnt)) {
    16311647                        /*
    16321648                         * The interval can be added by simply growing the left
     
    16351651                        leaf->value[leaf->keys - 1] += count;
    16361652                        goto success;
    1637                 } else if (page + (count << PAGE_WIDTH) == right_pg) {
     1653                } else if (page + P2SZ(count) == right_pg) {
    16381654                        /*
    16391655                         * The interval can be addded by simply moving base of
     
    16621678                 */
    16631679               
    1664                 if (overlaps(page, count << PAGE_WIDTH, left_pg,
    1665                     left_cnt << PAGE_WIDTH)) {
     1680                if (overlaps(page, P2SZ(count), left_pg, P2SZ(left_cnt))) {
    16661681                        /* The interval intersects with the left interval. */
    16671682                        return false;
    1668                 } else if (left_pg + (left_cnt << PAGE_WIDTH) == page) {
     1683                } else if (left_pg + P2SZ(left_cnt) == page) {
    16691684                        /*
    16701685                         * The interval can be added by growing the left
     
    17011716                         */
    17021717                       
    1703                         if (overlaps(page, count << PAGE_WIDTH, left_pg,
    1704                             left_cnt << PAGE_WIDTH)) {
     1718                        if (overlaps(page, P2SZ(count), left_pg,
     1719                            P2SZ(left_cnt))) {
    17051720                                /*
    17061721                                 * The interval intersects with the left
     
    17081723                                 */
    17091724                                return false;
    1710                         } else if (overlaps(page, count << PAGE_WIDTH, right_pg,
    1711                             right_cnt << PAGE_WIDTH)) {
     1725                        } else if (overlaps(page, P2SZ(count), right_pg,
     1726                            P2SZ(right_cnt))) {
    17121727                                /*
    17131728                                 * The interval intersects with the right
     
    17151730                                 */
    17161731                                return false;
    1717                         } else if ((page == left_pg + (left_cnt << PAGE_WIDTH)) &&
    1718                             (page + (count << PAGE_WIDTH) == right_pg)) {
     1732                        } else if ((page == left_pg + P2SZ(left_cnt)) &&
     1733                            (page + P2SZ(count) == right_pg)) {
    17191734                                /*
    17201735                                 * The interval can be added by merging the two
     
    17241739                                btree_remove(&area->used_space, right_pg, leaf);
    17251740                                goto success;
    1726                         } else if (page == left_pg + (left_cnt << PAGE_WIDTH)) {
     1741                        } else if (page == left_pg + P2SZ(left_cnt)) {
    17271742                                /*
    17281743                                 * The interval can be added by simply growing
     
    17311746                                leaf->value[i - 1] += count;
    17321747                                goto success;
    1733                         } else if (page + (count << PAGE_WIDTH) == right_pg) {
     1748                        } else if (page + P2SZ(count) == right_pg) {
    17341749                                /*
    17351750                                 * The interval can be addded by simply moving
     
    17971812                        for (i = 0; i < leaf->keys; i++) {
    17981813                                if (leaf->key[i] == page) {
    1799                                         leaf->key[i] += count << PAGE_WIDTH;
     1814                                        leaf->key[i] += P2SZ(count);
    18001815                                        leaf->value[i] -= count;
    18011816                                        goto success;
     
    18071822        }
    18081823       
    1809         btree_node_t *node = btree_leaf_node_left_neighbour(&area->used_space, leaf);
     1824        btree_node_t *node = btree_leaf_node_left_neighbour(&area->used_space,
     1825            leaf);
    18101826        if ((node) && (page < leaf->key[0])) {
    18111827                uintptr_t left_pg = node->key[node->keys - 1];
    18121828                size_t left_cnt = (size_t) node->value[node->keys - 1];
    18131829               
    1814                 if (overlaps(left_pg, left_cnt << PAGE_WIDTH, page,
    1815                     count << PAGE_WIDTH)) {
    1816                         if (page + (count << PAGE_WIDTH) ==
    1817                             left_pg + (left_cnt << PAGE_WIDTH)) {
     1830                if (overlaps(left_pg, P2SZ(left_cnt), page, P2SZ(count))) {
     1831                        if (page + P2SZ(count) == left_pg + P2SZ(left_cnt)) {
    18181832                                /*
    18191833                                 * The interval is contained in the rightmost
     
    18241838                                node->value[node->keys - 1] -= count;
    18251839                                goto success;
    1826                         } else if (page + (count << PAGE_WIDTH) <
    1827                             left_pg + (left_cnt << PAGE_WIDTH)) {
     1840                        } else if (page + P2SZ(count) <
     1841                            left_pg + P2SZ(left_cnt)) {
     1842                                size_t new_cnt;
     1843
    18281844                                /*
    18291845                                 * The interval is contained in the rightmost
     
    18331849                                 * new interval.
    18341850                                 */
    1835                                 size_t new_cnt = ((left_pg + (left_cnt << PAGE_WIDTH)) -
    1836                                     (page + (count << PAGE_WIDTH))) >> PAGE_WIDTH;
     1851                                new_cnt = ((left_pg + P2SZ(left_cnt)) -
     1852                                    (page + P2SZ(count))) >> PAGE_WIDTH;
    18371853                                node->value[node->keys - 1] -= count + new_cnt;
    18381854                                btree_insert(&area->used_space, page +
    1839                                     (count << PAGE_WIDTH), (void *) new_cnt, leaf);
     1855                                    P2SZ(count), (void *) new_cnt, leaf);
    18401856                                goto success;
    18411857                        }
     
    18501866                size_t left_cnt = (size_t) leaf->value[leaf->keys - 1];
    18511867               
    1852                 if (overlaps(left_pg, left_cnt << PAGE_WIDTH, page,
    1853                     count << PAGE_WIDTH)) {
    1854                         if (page + (count << PAGE_WIDTH) ==
    1855                             left_pg + (left_cnt << PAGE_WIDTH)) {
     1868                if (overlaps(left_pg, P2SZ(left_cnt), page, P2SZ(count))) {
     1869                        if (page + P2SZ(count) == left_pg + P2SZ(left_cnt)) {
    18561870                                /*
    18571871                                 * The interval is contained in the rightmost
     
    18611875                                leaf->value[leaf->keys - 1] -= count;
    18621876                                goto success;
    1863                         } else if (page + (count << PAGE_WIDTH) < left_pg +
    1864                             (left_cnt << PAGE_WIDTH)) {
     1877                        } else if (page + P2SZ(count) < left_pg +
     1878                            P2SZ(left_cnt)) {
     1879                                size_t new_cnt;
     1880
    18651881                                /*
    18661882                                 * The interval is contained in the rightmost
     
    18701886                                 * interval.
    18711887                                 */
    1872                                 size_t new_cnt = ((left_pg + (left_cnt << PAGE_WIDTH)) -
    1873                                     (page + (count << PAGE_WIDTH))) >> PAGE_WIDTH;
     1888                                new_cnt = ((left_pg + P2SZ(left_cnt)) -
     1889                                    (page + P2SZ(count))) >> PAGE_WIDTH;
    18741890                                leaf->value[leaf->keys - 1] -= count + new_cnt;
    18751891                                btree_insert(&area->used_space, page +
    1876                                     (count << PAGE_WIDTH), (void *) new_cnt, leaf);
     1892                                    P2SZ(count), (void *) new_cnt, leaf);
    18771893                                goto success;
    18781894                        }
     
    18961912                         * to (i - 1) and i.
    18971913                         */
    1898                         if (overlaps(left_pg, left_cnt << PAGE_WIDTH, page,
    1899                             count << PAGE_WIDTH)) {
    1900                                 if (page + (count << PAGE_WIDTH) ==
    1901                                     left_pg + (left_cnt << PAGE_WIDTH)) {
     1914                        if (overlaps(left_pg, P2SZ(left_cnt), page,
     1915                            P2SZ(count))) {
     1916                                if (page + P2SZ(count) ==
     1917                                    left_pg + P2SZ(left_cnt)) {
    19021918                                        /*
    19031919                                         * The interval is contained in the
     
    19081924                                        leaf->value[i - 1] -= count;
    19091925                                        goto success;
    1910                                 } else if (page + (count << PAGE_WIDTH) <
    1911                                     left_pg + (left_cnt << PAGE_WIDTH)) {
     1926                                } else if (page + P2SZ(count) <
     1927                                    left_pg + P2SZ(left_cnt)) {
     1928                                        size_t new_cnt;
     1929
    19121930                                        /*
    19131931                                         * The interval is contained in the
     
    19171935                                         * also inserting a new interval.
    19181936                                         */
    1919                                         size_t new_cnt = ((left_pg +
    1920                                             (left_cnt << PAGE_WIDTH)) -
    1921                                             (page + (count << PAGE_WIDTH))) >>
     1937                                        new_cnt = ((left_pg + P2SZ(left_cnt)) -
     1938                                            (page + P2SZ(count))) >>
    19221939                                            PAGE_WIDTH;
    19231940                                        leaf->value[i - 1] -= count + new_cnt;
    19241941                                        btree_insert(&area->used_space, page +
    1925                                             (count << PAGE_WIDTH), (void *) new_cnt,
     1942                                            P2SZ(count), (void *) new_cnt,
    19261943                                            leaf);
    19271944                                        goto success;
     
    20192036                btree_key_t i;
    20202037                for (i = 0; (ret == 0) && (i < node->keys); i++) {
     2038                        uintptr_t addr;
     2039
    20212040                        as_area_t *area = (as_area_t *) node->value[i];
    20222041                       
    20232042                        mutex_lock(&area->lock);
    20242043                       
    2025                         uintptr_t addr =
    2026                             ALIGN_UP(area->base + (area->pages << PAGE_WIDTH),
     2044                        addr = ALIGN_UP(area->base + P2SZ(area->pages),
    20272045                            PAGE_SIZE);
    20282046                       
     
    20832101                       
    20842102                        info[area_idx].start_addr = area->base;
    2085                         info[area_idx].size = FRAMES2SIZE(area->pages);
     2103                        info[area_idx].size = P2SZ(area->pages);
    20862104                        info[area_idx].flags = area->flags;
    20872105                        ++area_idx;
     
    21212139                            " (%p - %p)\n", area, (void *) area->base,
    21222140                            area->pages, (void *) area->base,
    2123                             (void *) (area->base + FRAMES2SIZE(area->pages)));
     2141                            (void *) (area->base + P2SZ(area->pages)));
    21242142                        mutex_unlock(&area->lock);
    21252143                }
Note: See TracChangeset for help on using the changeset viewer.