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