Rev 3127 | Rev 3425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3127 | Rev 3424 | ||
|---|---|---|---|
| Line 322... | Line 322... | ||
| 322 | a->sh_info = NULL; |
322 | a->sh_info = NULL; |
| 323 | a->backend = backend; |
323 | a->backend = backend; |
| 324 | if (backend_data) |
324 | if (backend_data) |
| 325 | a->backend_data = *backend_data; |
325 | a->backend_data = *backend_data; |
| 326 | else |
326 | else |
| 327 | memsetb((uintptr_t) &a->backend_data, sizeof(a->backend_data), |
327 | memsetb(&a->backend_data, sizeof(a->backend_data), 0); |
| 328 | 0); |
- | |
| 329 | 328 | ||
| 330 | btree_create(&a->used_space); |
329 | btree_create(&a->used_space); |
| 331 | 330 | ||
| 332 | btree_insert(&as->as_area_btree, base, (void *) a, NULL); |
331 | btree_insert(&as->as_area_btree, base, (void *) a, NULL); |
| 333 | 332 | ||
| Line 451... | Line 450... | ||
| 451 | * address space area. |
450 | * address space area. |
| 452 | */ |
451 | */ |
| 453 | 452 | ||
| 454 | cond = false; /* we are almost done */ |
453 | cond = false; /* we are almost done */ |
| 455 | i = (start_free - b) >> PAGE_WIDTH; |
454 | i = (start_free - b) >> PAGE_WIDTH; |
| 456 | if (!used_space_remove(area, start_free, |
455 | if (!used_space_remove(area, start_free, c - i)) |
| 457 | c - i)) |
- | |
| 458 | panic("Could not remove used " |
456 | panic("Could not remove used space.\n"); |
| 459 | "space.\n"); |
- | |
| 460 | } else { |
457 | } else { |
| 461 | /* |
458 | /* |
| 462 | * The interval of used space can be |
459 | * The interval of used space can be |
| 463 | * completely removed. |
460 | * completely removed. |
| 464 | */ |
461 | */ |
| 465 | if (!used_space_remove(area, b, c)) |
462 | if (!used_space_remove(area, b, c)) |
| 466 | panic("Could not remove used " |
463 | panic("Could not remove used space.\n"); |
| 467 | "space.\n"); |
- | |
| 468 | } |
464 | } |
| 469 | 465 | ||
| 470 | for (; i < c; i++) { |
466 | for (; i < c; i++) { |
| 471 | pte_t *pte; |
467 | pte_t *pte; |
| 472 | 468 | ||
| Line 1726... | Line 1722... | ||
| 1726 | return 1; |
1722 | return 1; |
| 1727 | } |
1723 | } |
| 1728 | } |
1724 | } |
| 1729 | } |
1725 | } |
| 1730 | 1726 | ||
| 1731 | panic("Inconsistency detected while adding %d pages of used space at " |
1727 | panic("Inconsistency detected while adding %" PRIc " pages of used space at " |
| 1732 | "%p.\n", count, page); |
1728 | "%p.\n", count, page); |
| 1733 | } |
1729 | } |
| 1734 | 1730 | ||
| 1735 | /** Mark portion of address space area as unused. |
1731 | /** Mark portion of address space area as unused. |
| 1736 | * |
1732 | * |
| Line 1905... | Line 1901... | ||
| 1905 | return 0; |
1901 | return 0; |
| 1906 | } |
1902 | } |
| 1907 | } |
1903 | } |
| 1908 | 1904 | ||
| 1909 | error: |
1905 | error: |
| 1910 | panic("Inconsistency detected while removing %d pages of used space " |
1906 | panic("Inconsistency detected while removing %" PRIc " pages of used space " |
| 1911 | "from %p.\n", count, page); |
1907 | "from %p.\n", count, page); |
| 1912 | } |
1908 | } |
| 1913 | 1909 | ||
| 1914 | /** Remove reference to address space area share info. |
1910 | /** Remove reference to address space area share info. |
| 1915 | * |
1911 | * |
| Line 1998... | Line 1994... | ||
| 1998 | unsigned int i; |
1994 | unsigned int i; |
| 1999 | for (i = 0; i < node->keys; i++) { |
1995 | for (i = 0; i < node->keys; i++) { |
| 2000 | as_area_t *area = node->value[i]; |
1996 | as_area_t *area = node->value[i]; |
| 2001 | 1997 | ||
| 2002 | mutex_lock(&area->lock); |
1998 | mutex_lock(&area->lock); |
| 2003 | printf("as_area: %p, base=%p, pages=%d (%p - %p)\n", |
1999 | printf("as_area: %p, base=%p, pages=%" PRIc " (%p - %p)\n", |
| 2004 | area, area->base, area->pages, area->base, |
2000 | area, area->base, area->pages, area->base, |
| 2005 | area->base + area->pages*PAGE_SIZE); |
2001 | area->base + FRAMES2SIZE(area->pages)); |
| 2006 | mutex_unlock(&area->lock); |
2002 | mutex_unlock(&area->lock); |
| 2007 | } |
2003 | } |
| 2008 | } |
2004 | } |
| 2009 | 2005 | ||
| 2010 | mutex_unlock(&as->lock); |
2006 | mutex_unlock(&as->lock); |