Changes in kernel/generic/src/mm/as.c [e394b736:fc47885] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/as.c
re394b736 rfc47885 71 71 #include <memstr.h> 72 72 #include <macros.h> 73 #include <bitops.h>74 73 #include <arch.h> 75 74 #include <errno.h> … … 80 79 #include <arch/interrupt.h> 81 80 81 #ifdef CONFIG_VIRT_IDX_DCACHE 82 #include <arch/mm/cache.h> 83 #endif /* CONFIG_VIRT_IDX_DCACHE */ 84 82 85 /** 83 86 * Each architecture decides what functions will be used to carry out … … 285 288 /** Check area conflicts with other areas. 286 289 * 287 * @param as Address space.288 * @param addrStarting virtual address of the area being tested.289 * @param count Number of pages inthe area being tested.290 * @param avoid Do not touch this area.290 * @param as Address space. 291 * @param va Starting virtual address of the area being tested. 292 * @param size Size of the area being tested. 293 * @param avoid_area Do not touch this area. 291 294 * 292 295 * @return True if there is no conflict, false otherwise. 293 296 * 294 297 */ 295 NO_TRACE static bool check_area_conflicts(as_t *as, uintptr_t addr, 296 size_t count, as_area_t *avoid) 297 { 298 ASSERT((addr % PAGE_SIZE) == 0); 298 NO_TRACE static bool check_area_conflicts(as_t *as, uintptr_t va, size_t size, 299 as_area_t *avoid_area) 300 { 299 301 ASSERT(mutex_locked(&as->lock)); 300 302 … … 302 304 * We don't want any area to have conflicts with NULL page. 303 305 */ 304 if (overlaps( addr, count << PAGE_WIDTH, (uintptr_t) NULL, PAGE_SIZE))306 if (overlaps(va, size, (uintptr_t) NULL, PAGE_SIZE)) 305 307 return false; 306 308 … … 314 316 btree_node_t *leaf; 315 317 as_area_t *area = 316 (as_area_t *) btree_search(&as->as_area_btree, addr, &leaf);318 (as_area_t *) btree_search(&as->as_area_btree, va, &leaf); 317 319 if (area) { 318 if (area != avoid )320 if (area != avoid_area) 319 321 return false; 320 322 } … … 326 328 area = (as_area_t *) node->value[node->keys - 1]; 327 329 328 if (area != avoid) { 329 mutex_lock(&area->lock); 330 331 if (overlaps(addr, count << PAGE_WIDTH, 332 area->base, area->pages << PAGE_WIDTH)) { 333 mutex_unlock(&area->lock); 334 return false; 335 } 336 330 mutex_lock(&area->lock); 331 332 if (overlaps(va, size, area->base, area->pages * PAGE_SIZE)) { 337 333 mutex_unlock(&area->lock); 338 } 334 return false; 335 } 336 337 mutex_unlock(&area->lock); 339 338 } 340 339 … … 343 342 area = (as_area_t *) node->value[0]; 344 343 345 if (area != avoid) { 346 mutex_lock(&area->lock); 347 348 if (overlaps(addr, count << PAGE_WIDTH, 349 area->base, area->pages << PAGE_WIDTH)) { 350 mutex_unlock(&area->lock); 351 return false; 352 } 353 344 mutex_lock(&area->lock); 345 346 if (overlaps(va, size, area->base, area->pages * PAGE_SIZE)) { 354 347 mutex_unlock(&area->lock); 355 } 348 return false; 349 } 350 351 mutex_unlock(&area->lock); 356 352 } 357 353 … … 361 357 area = (as_area_t *) leaf->value[i]; 362 358 363 if (area == avoid )359 if (area == avoid_area) 364 360 continue; 365 361 366 362 mutex_lock(&area->lock); 367 363 368 if (overlaps(addr, count << PAGE_WIDTH, 369 area->base, area->pages << PAGE_WIDTH)) { 364 if (overlaps(va, size, area->base, area->pages * PAGE_SIZE)) { 370 365 mutex_unlock(&area->lock); 371 366 return false; … … 380 375 */ 381 376 if (!KERNEL_ADDRESS_SPACE_SHADOWED) { 382 return !overlaps( addr, count << PAGE_WIDTH,377 return !overlaps(va, size, 383 378 KERNEL_ADDRESS_SPACE_START, 384 379 KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START); … … 407 402 mem_backend_data_t *backend_data) 408 403 { 409 if ( (base % PAGE_SIZE) != 0)404 if (base % PAGE_SIZE) 410 405 return NULL; 411 406 412 if ( size == 0)407 if (!size) 413 408 return NULL; 414 415 size_t pages = SIZE2FRAMES(size);416 409 417 410 /* Writeable executable areas are not supported. */ … … 421 414 mutex_lock(&as->lock); 422 415 423 if (!check_area_conflicts(as, base, pages, NULL)) {416 if (!check_area_conflicts(as, base, size, NULL)) { 424 417 mutex_unlock(&as->lock); 425 418 return NULL; … … 433 426 area->flags = flags; 434 427 area->attributes = attrs; 435 area->pages = pages;428 area->pages = SIZE2FRAMES(size); 436 429 area->resident = 0; 437 430 area->base = base; … … 443 436 else 444 437 memsetb(&area->backend_data, sizeof(area->backend_data), 0); 445 446 if (area->backend && area->backend->create) {447 if (!area->backend->create(area)) {448 free(area);449 mutex_unlock(&as->lock);450 return NULL;451 }452 }453 438 454 439 btree_create(&area->used_space); … … 495 480 mutex_lock(&area->lock); 496 481 497 if ((area->base <= va) && 498 (va < area->base + (area->pages << PAGE_WIDTH))) 482 if ((area->base <= va) && (va < area->base + area->pages * PAGE_SIZE)) 499 483 return area; 500 484 … … 512 496 mutex_lock(&area->lock); 513 497 514 if (va < area->base + (area->pages << PAGE_WIDTH))498 if (va < area->base + area->pages * PAGE_SIZE) 515 499 return area; 516 500 … … 577 561 578 562 if (pages < area->pages) { 579 uintptr_t start_free = area->base + (pages << PAGE_WIDTH);563 uintptr_t start_free = area->base + pages * PAGE_SIZE; 580 564 581 565 /* … … 590 574 */ 591 575 ipl_t ipl = tlb_shootdown_start(TLB_INVL_PAGES, as->asid, 592 area->base + (pages << PAGE_WIDTH), area->pages - pages);576 area->base + pages * PAGE_SIZE, area->pages - pages); 593 577 594 578 /* … … 613 597 size_t i = 0; 614 598 615 if (overlaps(ptr, size << PAGE_WIDTH, area->base,616 pages << PAGE_WIDTH)) {599 if (overlaps(ptr, size * PAGE_SIZE, area->base, 600 pages * PAGE_SIZE)) { 617 601 618 if (ptr + (size << PAGE_WIDTH)<= start_free) {602 if (ptr + size * PAGE_SIZE <= start_free) { 619 603 /* 620 604 * The whole interval fits … … 648 632 for (; i < size; i++) { 649 633 pte_t *pte = page_mapping_find(as, ptr + 650 (i << PAGE_WIDTH));634 i * PAGE_SIZE); 651 635 652 636 ASSERT(pte); … … 657 641 (area->backend->frame_free)) { 658 642 area->backend->frame_free(area, 659 ptr + (i << PAGE_WIDTH),643 ptr + i * PAGE_SIZE, 660 644 PTE_GET_FRAME(pte)); 661 645 } 662 646 663 647 page_mapping_remove(as, ptr + 664 (i << PAGE_WIDTH));648 i * PAGE_SIZE); 665 649 } 666 650 } … … 671 655 */ 672 656 673 tlb_invalidate_pages(as->asid, area->base + (pages << PAGE_WIDTH),657 tlb_invalidate_pages(as->asid, area->base + pages * PAGE_SIZE, 674 658 area->pages - pages); 675 659 … … 678 662 */ 679 663 as_invalidate_translation_cache(as, area->base + 680 (pages << PAGE_WIDTH), area->pages - pages);664 pages * PAGE_SIZE, area->pages - pages); 681 665 tlb_shootdown_finalize(ipl); 682 666 … … 687 671 * Check for overlaps with other address space areas. 688 672 */ 689 if (!check_area_conflicts(as, address, pages, area)) { 673 if (!check_area_conflicts(as, address, pages * PAGE_SIZE, 674 area)) { 690 675 mutex_unlock(&area->lock); 691 676 mutex_unlock(&as->lock); 692 677 return EADDRNOTAVAIL; 693 }694 }695 696 if (area->backend && area->backend->resize) {697 if (!area->backend->resize(area, pages)) {698 mutex_unlock(&area->lock);699 mutex_unlock(&as->lock);700 return ENOMEM;701 678 } 702 679 } … … 768 745 return ENOENT; 769 746 } 770 771 if (area->backend && area->backend->destroy)772 area->backend->destroy(area);773 747 774 748 uintptr_t base = area->base; … … 797 771 798 772 for (size = 0; size < (size_t) node->value[i]; size++) { 799 pte_t *pte = 800 page_mapping_find(as, ptr + (size << PAGE_WIDTH)); 773 pte_t *pte = page_mapping_find(as, ptr + size * PAGE_SIZE); 801 774 802 775 ASSERT(pte); … … 807 780 (area->backend->frame_free)) { 808 781 area->backend->frame_free(area, 809 ptr + (size << PAGE_WIDTH), PTE_GET_FRAME(pte));782 ptr + size * PAGE_SIZE, PTE_GET_FRAME(pte)); 810 783 } 811 784 812 page_mapping_remove(as, ptr + (size << PAGE_WIDTH));785 page_mapping_remove(as, ptr + size * PAGE_SIZE); 813 786 } 814 787 } … … 897 870 } 898 871 899 size_t src_size = src_area->pages << PAGE_WIDTH;872 size_t src_size = src_area->pages * PAGE_SIZE; 900 873 unsigned int src_flags = src_area->flags; 901 874 mem_backend_t *src_backend = src_area->backend; … … 1103 1076 1104 1077 for (size = 0; size < (size_t) node->value[i]; size++) { 1105 pte_t *pte = 1106 page_mapping_find(as, ptr + (size << PAGE_WIDTH)); 1078 pte_t *pte = page_mapping_find(as, ptr + size * PAGE_SIZE); 1107 1079 1108 1080 ASSERT(pte); … … 1113 1085 1114 1086 /* Remove old mapping */ 1115 page_mapping_remove(as, ptr + (size << PAGE_WIDTH));1087 page_mapping_remove(as, ptr + size * PAGE_SIZE); 1116 1088 } 1117 1089 } … … 1159 1131 1160 1132 /* Insert the new mapping */ 1161 page_mapping_insert(as, ptr + (size << PAGE_WIDTH),1133 page_mapping_insert(as, ptr + size * PAGE_SIZE, 1162 1134 old_frame[frame_idx++], page_flags); 1163 1135 … … 1481 1453 1482 1454 if (src_area) { 1483 size = src_area->pages << PAGE_WIDTH;1455 size = src_area->pages * PAGE_SIZE; 1484 1456 mutex_unlock(&src_area->lock); 1485 1457 } else … … 1536 1508 if (page >= right_pg) { 1537 1509 /* Do nothing. */ 1538 } else if (overlaps(page, count << PAGE_WIDTH, left_pg,1539 left_cnt << PAGE_WIDTH)) {1510 } else if (overlaps(page, count * PAGE_SIZE, left_pg, 1511 left_cnt * PAGE_SIZE)) { 1540 1512 /* The interval intersects with the left interval. */ 1541 1513 return false; 1542 } else if (overlaps(page, count << PAGE_WIDTH, right_pg,1543 right_cnt << PAGE_WIDTH)) {1514 } else if (overlaps(page, count * PAGE_SIZE, right_pg, 1515 right_cnt * PAGE_SIZE)) { 1544 1516 /* The interval intersects with the right interval. */ 1545 1517 return false; 1546 } else if ((page == left_pg + (left_cnt << PAGE_WIDTH)) &&1547 (page + (count << PAGE_WIDTH)== right_pg)) {1518 } else if ((page == left_pg + left_cnt * PAGE_SIZE) && 1519 (page + count * PAGE_SIZE == right_pg)) { 1548 1520 /* 1549 1521 * The interval can be added by merging the two already … … 1553 1525 btree_remove(&area->used_space, right_pg, leaf); 1554 1526 goto success; 1555 } else if (page == left_pg + (left_cnt << PAGE_WIDTH)) {1527 } else if (page == left_pg + left_cnt * PAGE_SIZE) { 1556 1528 /* 1557 1529 * The interval can be added by simply growing the left … … 1560 1532 node->value[node->keys - 1] += count; 1561 1533 goto success; 1562 } else if (page + (count << PAGE_WIDTH)== right_pg) {1534 } else if (page + count * PAGE_SIZE == right_pg) { 1563 1535 /* 1564 1536 * The interval can be addded by simply moving base of … … 1587 1559 */ 1588 1560 1589 if (overlaps(page, count << PAGE_WIDTH, right_pg,1590 right_cnt << PAGE_WIDTH)) {1561 if (overlaps(page, count * PAGE_SIZE, right_pg, 1562 right_cnt * PAGE_SIZE)) { 1591 1563 /* The interval intersects with the right interval. */ 1592 1564 return false; 1593 } else if (page + (count << PAGE_WIDTH)== right_pg) {1565 } else if (page + count * PAGE_SIZE == right_pg) { 1594 1566 /* 1595 1567 * The interval can be added by moving the base of the … … 1626 1598 if (page < left_pg) { 1627 1599 /* Do nothing. */ 1628 } else if (overlaps(page, count << PAGE_WIDTH, left_pg,1629 left_cnt << PAGE_WIDTH)) {1600 } else if (overlaps(page, count * PAGE_SIZE, left_pg, 1601 left_cnt * PAGE_SIZE)) { 1630 1602 /* The interval intersects with the left interval. */ 1631 1603 return false; 1632 } else if (overlaps(page, count << PAGE_WIDTH, right_pg,1633 right_cnt << PAGE_WIDTH)) {1604 } else if (overlaps(page, count * PAGE_SIZE, right_pg, 1605 right_cnt * PAGE_SIZE)) { 1634 1606 /* The interval intersects with the right interval. */ 1635 1607 return false; 1636 } else if ((page == left_pg + (left_cnt << PAGE_WIDTH)) &&1637 (page + (count << PAGE_WIDTH)== right_pg)) {1608 } else if ((page == left_pg + left_cnt * PAGE_SIZE) && 1609 (page + count * PAGE_SIZE == right_pg)) { 1638 1610 /* 1639 1611 * The interval can be added by merging the two already … … 1643 1615 btree_remove(&area->used_space, right_pg, node); 1644 1616 goto success; 1645 } else if (page == left_pg + (left_cnt << PAGE_WIDTH)) {1617 } else if (page == left_pg + left_cnt * PAGE_SIZE) { 1646 1618 /* 1647 1619 * The interval can be added by simply growing the left … … 1650 1622 leaf->value[leaf->keys - 1] += count; 1651 1623 goto success; 1652 } else if (page + (count << PAGE_WIDTH)== right_pg) {1624 } else if (page + count * PAGE_SIZE == right_pg) { 1653 1625 /* 1654 1626 * The interval can be addded by simply moving base of … … 1677 1649 */ 1678 1650 1679 if (overlaps(page, count << PAGE_WIDTH, left_pg,1680 left_cnt << PAGE_WIDTH)) {1651 if (overlaps(page, count * PAGE_SIZE, left_pg, 1652 left_cnt * PAGE_SIZE)) { 1681 1653 /* The interval intersects with the left interval. */ 1682 1654 return false; 1683 } else if (left_pg + (left_cnt << PAGE_WIDTH)== page) {1655 } else if (left_pg + left_cnt * PAGE_SIZE == page) { 1684 1656 /* 1685 1657 * The interval can be added by growing the left … … 1716 1688 */ 1717 1689 1718 if (overlaps(page, count << PAGE_WIDTH, left_pg,1719 left_cnt << PAGE_WIDTH)) {1690 if (overlaps(page, count * PAGE_SIZE, left_pg, 1691 left_cnt * PAGE_SIZE)) { 1720 1692 /* 1721 1693 * The interval intersects with the left … … 1723 1695 */ 1724 1696 return false; 1725 } else if (overlaps(page, count << PAGE_WIDTH, right_pg,1726 right_cnt << PAGE_WIDTH)) {1697 } else if (overlaps(page, count * PAGE_SIZE, right_pg, 1698 right_cnt * PAGE_SIZE)) { 1727 1699 /* 1728 1700 * The interval intersects with the right … … 1730 1702 */ 1731 1703 return false; 1732 } else if ((page == left_pg + (left_cnt << PAGE_WIDTH)) &&1733 (page + (count << PAGE_WIDTH)== right_pg)) {1704 } else if ((page == left_pg + left_cnt * PAGE_SIZE) && 1705 (page + count * PAGE_SIZE == right_pg)) { 1734 1706 /* 1735 1707 * The interval can be added by merging the two … … 1739 1711 btree_remove(&area->used_space, right_pg, leaf); 1740 1712 goto success; 1741 } else if (page == left_pg + (left_cnt << PAGE_WIDTH)) {1713 } else if (page == left_pg + left_cnt * PAGE_SIZE) { 1742 1714 /* 1743 1715 * The interval can be added by simply growing … … 1746 1718 leaf->value[i - 1] += count; 1747 1719 goto success; 1748 } else if (page + (count << PAGE_WIDTH)== right_pg) {1720 } else if (page + count * PAGE_SIZE == right_pg) { 1749 1721 /* 1750 1722 * The interval can be addded by simply moving … … 1812 1784 for (i = 0; i < leaf->keys; i++) { 1813 1785 if (leaf->key[i] == page) { 1814 leaf->key[i] += count << PAGE_WIDTH;1786 leaf->key[i] += count * PAGE_SIZE; 1815 1787 leaf->value[i] -= count; 1816 1788 goto success; … … 1827 1799 size_t left_cnt = (size_t) node->value[node->keys - 1]; 1828 1800 1829 if (overlaps(left_pg, left_cnt << PAGE_WIDTH, page,1830 count << PAGE_WIDTH)) {1831 if (page + (count << PAGE_WIDTH)==1832 left_pg + (left_cnt << PAGE_WIDTH)) {1801 if (overlaps(left_pg, left_cnt * PAGE_SIZE, page, 1802 count * PAGE_SIZE)) { 1803 if (page + count * PAGE_SIZE == 1804 left_pg + left_cnt * PAGE_SIZE) { 1833 1805 /* 1834 1806 * The interval is contained in the rightmost … … 1839 1811 node->value[node->keys - 1] -= count; 1840 1812 goto success; 1841 } else if (page + (count << PAGE_WIDTH)<1842 left_pg + (left_cnt << PAGE_WIDTH)) {1813 } else if (page + count * PAGE_SIZE < 1814 left_pg + left_cnt*PAGE_SIZE) { 1843 1815 /* 1844 1816 * The interval is contained in the rightmost … … 1848 1820 * new interval. 1849 1821 */ 1850 size_t new_cnt = ((left_pg + (left_cnt << PAGE_WIDTH)) -1851 (page + (count << PAGE_WIDTH))) >> PAGE_WIDTH;1822 size_t new_cnt = ((left_pg + left_cnt * PAGE_SIZE) - 1823 (page + count*PAGE_SIZE)) >> PAGE_WIDTH; 1852 1824 node->value[node->keys - 1] -= count + new_cnt; 1853 1825 btree_insert(&area->used_space, page + 1854 (count << PAGE_WIDTH), (void *) new_cnt, leaf);1826 count * PAGE_SIZE, (void *) new_cnt, leaf); 1855 1827 goto success; 1856 1828 } … … 1865 1837 size_t left_cnt = (size_t) leaf->value[leaf->keys - 1]; 1866 1838 1867 if (overlaps(left_pg, left_cnt << PAGE_WIDTH, page,1868 count << PAGE_WIDTH)) {1869 if (page + (count << PAGE_WIDTH)==1870 left_pg + (left_cnt << PAGE_WIDTH)) {1839 if (overlaps(left_pg, left_cnt * PAGE_SIZE, page, 1840 count * PAGE_SIZE)) { 1841 if (page + count * PAGE_SIZE == 1842 left_pg + left_cnt * PAGE_SIZE) { 1871 1843 /* 1872 1844 * The interval is contained in the rightmost … … 1876 1848 leaf->value[leaf->keys - 1] -= count; 1877 1849 goto success; 1878 } else if (page + (count << PAGE_WIDTH)< left_pg +1879 (left_cnt << PAGE_WIDTH)) {1850 } else if (page + count * PAGE_SIZE < left_pg + 1851 left_cnt * PAGE_SIZE) { 1880 1852 /* 1881 1853 * The interval is contained in the rightmost … … 1885 1857 * interval. 1886 1858 */ 1887 size_t new_cnt = ((left_pg + (left_cnt << PAGE_WIDTH)) -1888 (page + (count << PAGE_WIDTH))) >> PAGE_WIDTH;1859 size_t new_cnt = ((left_pg + left_cnt * PAGE_SIZE) - 1860 (page + count * PAGE_SIZE)) >> PAGE_WIDTH; 1889 1861 leaf->value[leaf->keys - 1] -= count + new_cnt; 1890 1862 btree_insert(&area->used_space, page + 1891 (count << PAGE_WIDTH), (void *) new_cnt, leaf);1863 count * PAGE_SIZE, (void *) new_cnt, leaf); 1892 1864 goto success; 1893 1865 } … … 1911 1883 * to (i - 1) and i. 1912 1884 */ 1913 if (overlaps(left_pg, left_cnt << PAGE_WIDTH, page,1914 count << PAGE_WIDTH)) {1915 if (page + (count << PAGE_WIDTH)==1916 left_pg + (left_cnt << PAGE_WIDTH)) {1885 if (overlaps(left_pg, left_cnt * PAGE_SIZE, page, 1886 count * PAGE_SIZE)) { 1887 if (page + count * PAGE_SIZE == 1888 left_pg + left_cnt*PAGE_SIZE) { 1917 1889 /* 1918 1890 * The interval is contained in the … … 1923 1895 leaf->value[i - 1] -= count; 1924 1896 goto success; 1925 } else if (page + (count << PAGE_WIDTH)<1926 left_pg + (left_cnt << PAGE_WIDTH)) {1897 } else if (page + count * PAGE_SIZE < 1898 left_pg + left_cnt * PAGE_SIZE) { 1927 1899 /* 1928 1900 * The interval is contained in the … … 1933 1905 */ 1934 1906 size_t new_cnt = ((left_pg + 1935 (left_cnt << PAGE_WIDTH)) -1936 (page + (count << PAGE_WIDTH))) >>1907 left_cnt * PAGE_SIZE) - 1908 (page + count * PAGE_SIZE)) >> 1937 1909 PAGE_WIDTH; 1938 1910 leaf->value[i - 1] -= count + new_cnt; 1939 1911 btree_insert(&area->used_space, page + 1940 (count << PAGE_WIDTH), (void *) new_cnt,1912 count * PAGE_SIZE, (void *) new_cnt, 1941 1913 leaf); 1942 1914 goto success; … … 1987 1959 { 1988 1960 return (sysarg_t) as_area_destroy(AS, address); 1989 }1990 1991 /** Return pointer to unmapped address space area1992 *1993 * @param base Lowest address bound.1994 * @param size Requested size of the allocation.1995 *1996 * @return Pointer to the beginning of unmapped address space area.1997 *1998 */1999 sysarg_t sys_as_get_unmapped_area(uintptr_t base, size_t size)2000 {2001 if (size == 0)2002 return 0;2003 2004 /*2005 * Make sure we allocate from page-aligned2006 * address. Check for possible overflow in2007 * each step.2008 */2009 2010 size_t pages = SIZE2FRAMES(size);2011 uintptr_t ret = 0;2012 2013 /*2014 * Find the lowest unmapped address aligned on the sz2015 * boundary, not smaller than base and of the required size.2016 */2017 2018 mutex_lock(&AS->lock);2019 2020 /* First check the base address itself */2021 uintptr_t addr = ALIGN_UP(base, PAGE_SIZE);2022 if ((addr >= base) &&2023 (check_area_conflicts(AS, addr, pages, NULL)))2024 ret = addr;2025 2026 /* Eventually check the addresses behind each area */2027 link_t *cur;2028 for (cur = AS->as_area_btree.leaf_head.next;2029 (ret == 0) && (cur != &AS->as_area_btree.leaf_head);2030 cur = cur->next) {2031 btree_node_t *node =2032 list_get_instance(cur, btree_node_t, leaf_link);2033 2034 btree_key_t i;2035 for (i = 0; (ret == 0) && (i < node->keys); i++) {2036 as_area_t *area = (as_area_t *) node->value[i];2037 2038 mutex_lock(&area->lock);2039 2040 uintptr_t addr =2041 ALIGN_UP(area->base + (area->pages << PAGE_WIDTH),2042 PAGE_SIZE);2043 2044 if ((addr >= base) && (addr >= area->base) &&2045 (check_area_conflicts(AS, addr, pages, area)))2046 ret = addr;2047 2048 mutex_unlock(&area->lock);2049 }2050 }2051 2052 mutex_unlock(&AS->lock);2053 2054 return (sysarg_t) ret;2055 1961 } 2056 1962 … … 2121 2027 mutex_lock(&as->lock); 2122 2028 2123 /* Print out info about address space areas */2029 /* print out info about address space areas */ 2124 2030 link_t *cur; 2125 2031 for (cur = as->as_area_btree.leaf_head.next;
Note:
See TracChangeset
for help on using the changeset viewer.