Changeset 98000fb in mainline for kernel/generic/src/mm/as.c
- Timestamp:
- 2009-06-03T19:34:45Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 301ff30
- Parents:
- 69e68e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/as.c
r69e68e3 r98000fb 419 419 if ((cond = (bool) node->keys)) { 420 420 uintptr_t b = node->key[node->keys - 1]; 421 count_t c =422 ( count_t) node->value[node->keys - 1];421 size_t c = 422 (size_t) node->value[node->keys - 1]; 423 423 unsigned int i = 0; 424 424 … … 556 556 for (i = 0; i < node->keys; i++) { 557 557 uintptr_t b = node->key[i]; 558 count_t j;558 size_t j; 559 559 pte_t *pte; 560 560 561 for (j = 0; j < ( count_t) node->value[i]; j++) {561 for (j = 0; j < (size_t) node->value[i]; j++) { 562 562 page_table_lock(as, false); 563 563 pte = page_mapping_find(as, b + j * PAGE_SIZE); … … 789 789 int page_flags; 790 790 uintptr_t *old_frame; 791 index_t frame_idx;792 count_t used_pages;791 size_t frame_idx; 792 size_t used_pages; 793 793 794 794 /* Flags for the new memory mapping */ … … 828 828 node = list_get_instance(cur, btree_node_t, leaf_link); 829 829 for (i = 0; i < node->keys; i++) { 830 used_pages += ( count_t) node->value[i];830 used_pages += (size_t) node->value[i]; 831 831 } 832 832 } … … 854 854 for (i = 0; i < node->keys; i++) { 855 855 uintptr_t b = node->key[i]; 856 count_t j;856 size_t j; 857 857 pte_t *pte; 858 858 859 for (j = 0; j < ( count_t) node->value[i]; j++) {859 for (j = 0; j < (size_t) node->value[i]; j++) { 860 860 page_table_lock(as, false); 861 861 pte = page_mapping_find(as, b + j * PAGE_SIZE); … … 904 904 for (i = 0; i < node->keys; i++) { 905 905 uintptr_t b = node->key[i]; 906 count_t j;906 size_t j; 907 907 908 for (j = 0; j < ( count_t) node->value[i]; j++) {908 for (j = 0; j < (size_t) node->value[i]; j++) { 909 909 page_table_lock(as, false); 910 910 … … 1398 1398 * @return Zero on failure and non-zero on success. 1399 1399 */ 1400 int used_space_insert(as_area_t *a, uintptr_t page, count_t count)1400 int used_space_insert(as_area_t *a, uintptr_t page, size_t count) 1401 1401 { 1402 1402 btree_node_t *leaf, *node; 1403 count_t pages;1403 size_t pages; 1404 1404 unsigned int i; 1405 1405 … … 1407 1407 ASSERT(count); 1408 1408 1409 pages = ( count_t) btree_search(&a->used_space, page, &leaf);1409 pages = (size_t) btree_search(&a->used_space, page, &leaf); 1410 1410 if (pages) { 1411 1411 /* … … 1424 1424 uintptr_t left_pg = node->key[node->keys - 1]; 1425 1425 uintptr_t right_pg = leaf->key[0]; 1426 count_t left_cnt = (count_t) node->value[node->keys - 1];1427 count_t right_cnt = (count_t) leaf->value[0];1426 size_t left_cnt = (size_t) node->value[node->keys - 1]; 1427 size_t right_cnt = (size_t) leaf->value[0]; 1428 1428 1429 1429 /* … … 1479 1479 } else if (page < leaf->key[0]) { 1480 1480 uintptr_t right_pg = leaf->key[0]; 1481 count_t right_cnt = (count_t) leaf->value[0];1481 size_t right_cnt = (size_t) leaf->value[0]; 1482 1482 1483 1483 /* … … 1514 1514 uintptr_t left_pg = leaf->key[leaf->keys - 1]; 1515 1515 uintptr_t right_pg = node->key[0]; 1516 count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];1517 count_t right_cnt = (count_t) node->value[0];1516 size_t left_cnt = (size_t) leaf->value[leaf->keys - 1]; 1517 size_t right_cnt = (size_t) node->value[0]; 1518 1518 1519 1519 /* … … 1569 1569 } else if (page >= leaf->key[leaf->keys - 1]) { 1570 1570 uintptr_t left_pg = leaf->key[leaf->keys - 1]; 1571 count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];1571 size_t left_cnt = (size_t) leaf->value[leaf->keys - 1]; 1572 1572 1573 1573 /* … … 1607 1607 uintptr_t left_pg = leaf->key[i - 1]; 1608 1608 uintptr_t right_pg = leaf->key[i]; 1609 count_t left_cnt = (count_t) leaf->value[i - 1];1610 count_t right_cnt = (count_t) leaf->value[i];1609 size_t left_cnt = (size_t) leaf->value[i - 1]; 1610 size_t right_cnt = (size_t) leaf->value[i]; 1611 1611 1612 1612 /* … … 1666 1666 } 1667 1667 1668 panic("Inconsistency detected while adding %" PRI c" pages of used "1668 panic("Inconsistency detected while adding %" PRIs " pages of used " 1669 1669 "space at %p.", count, page); 1670 1670 } … … 1680 1680 * @return Zero on failure and non-zero on success. 1681 1681 */ 1682 int used_space_remove(as_area_t *a, uintptr_t page, count_t count)1682 int used_space_remove(as_area_t *a, uintptr_t page, size_t count) 1683 1683 { 1684 1684 btree_node_t *leaf, *node; 1685 count_t pages;1685 size_t pages; 1686 1686 unsigned int i; 1687 1687 … … 1689 1689 ASSERT(count); 1690 1690 1691 pages = ( count_t) btree_search(&a->used_space, page, &leaf);1691 pages = (size_t) btree_search(&a->used_space, page, &leaf); 1692 1692 if (pages) { 1693 1693 /* … … 1718 1718 if (node && page < leaf->key[0]) { 1719 1719 uintptr_t left_pg = node->key[node->keys - 1]; 1720 count_t left_cnt = (count_t) node->value[node->keys - 1];1720 size_t left_cnt = (size_t) node->value[node->keys - 1]; 1721 1721 1722 1722 if (overlaps(left_pg, left_cnt * PAGE_SIZE, page, … … 1734 1734 } else if (page + count * PAGE_SIZE < 1735 1735 left_pg + left_cnt*PAGE_SIZE) { 1736 count_t new_cnt;1736 size_t new_cnt; 1737 1737 1738 1738 /* … … 1758 1758 if (page > leaf->key[leaf->keys - 1]) { 1759 1759 uintptr_t left_pg = leaf->key[leaf->keys - 1]; 1760 count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];1760 size_t left_cnt = (size_t) leaf->value[leaf->keys - 1]; 1761 1761 1762 1762 if (overlaps(left_pg, left_cnt * PAGE_SIZE, page, … … 1773 1773 } else if (page + count * PAGE_SIZE < left_pg + 1774 1774 left_cnt * PAGE_SIZE) { 1775 count_t new_cnt;1775 size_t new_cnt; 1776 1776 1777 1777 /* … … 1800 1800 if (page < leaf->key[i]) { 1801 1801 uintptr_t left_pg = leaf->key[i - 1]; 1802 count_t left_cnt = (count_t) leaf->value[i - 1];1802 size_t left_cnt = (size_t) leaf->value[i - 1]; 1803 1803 1804 1804 /* … … 1820 1820 } else if (page + count * PAGE_SIZE < 1821 1821 left_pg + left_cnt * PAGE_SIZE) { 1822 count_t new_cnt;1822 size_t new_cnt; 1823 1823 1824 1824 /* … … 1845 1845 1846 1846 error: 1847 panic("Inconsistency detected while removing %" PRI c" pages of used "1847 panic("Inconsistency detected while removing %" PRIs " pages of used " 1848 1848 "space from %p.", count, page); 1849 1849 } … … 1944 1944 1945 1945 mutex_lock(&area->lock); 1946 printf("as_area: %p, base=%p, pages=%" PRI c1946 printf("as_area: %p, base=%p, pages=%" PRIs 1947 1947 " (%p - %p)\n", area, area->base, area->pages, 1948 1948 area->base, area->base + FRAMES2SIZE(area->pages));
Note:
See TracChangeset
for help on using the changeset viewer.