Changeset 2b8b0ca in mainline
- Timestamp:
- 2008-06-03T14:46:49Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 93a3348
- Parents:
- 0f269c2
- Location:
- kernel/generic/src/mm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/as.c
r0f269c2 r2b8b0ca 454 454 cond = false; /* we are almost done */ 455 455 i = (start_free - b) >> PAGE_WIDTH; 456 if (!used_space_remove(area, start_free, 457 c - i)) 458 panic("Could not remove used " 459 "space.\n"); 456 if (!used_space_remove(area, start_free, c - i)) 457 panic("Could not remove used space.\n"); 460 458 } else { 461 459 /* … … 464 462 */ 465 463 if (!used_space_remove(area, b, c)) 466 panic("Could not remove used " 467 "space.\n"); 464 panic("Could not remove used space.\n"); 468 465 } 469 466 … … 1529 1526 } 1530 1527 1531 panic("Inconsistency detected while adding % dpages of used space at "1528 panic("Inconsistency detected while adding %" PRIc " pages of used space at " 1532 1529 "%p.\n", count, page); 1533 1530 } … … 1708 1705 1709 1706 error: 1710 panic("Inconsistency detected while removing % dpages of used space "1707 panic("Inconsistency detected while removing %" PRIc " pages of used space " 1711 1708 "from %p.\n", count, page); 1712 1709 } … … 1801 1798 1802 1799 mutex_lock(&area->lock); 1803 printf("as_area: %p, base=%p, pages=% d(%p - %p)\n",1800 printf("as_area: %p, base=%p, pages=%" PRIc " (%p - %p)\n", 1804 1801 area, area->base, area->pages, area->base, 1805 area->base + area->pages*PAGE_SIZE);1802 area->base + FRAMES2SIZE(area->pages)); 1806 1803 mutex_unlock(&area->lock); 1807 1804 } -
kernel/generic/src/mm/buddy.c
r0f269c2 r2b8b0ca 45 45 #include <debug.h> 46 46 #include <print.h> 47 #include <macros.h> 47 48 48 49 /** Return size needed for the buddy configuration data */ … … 290 291 index_t i; 291 292 count_t cnt, elem_count = 0, block_count = 0; 292 link_t * 293 link_t *cur; 293 294 294 295 … … 296 297 printf("-----\t------\t--------\t----------\t---------------\n"); 297 298 298 for (i =0;i <= b->max_order; i++) {299 for (i = 0;i <= b->max_order; i++) { 299 300 cnt = 0; 300 301 if (!list_empty(&b->order[i])) { … … 303 304 } 304 305 305 printf("#%zd\t%5zd\t%7zdK\t%8zdK\t%6zd\t", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i); 306 printf("#%" PRIi "\t%5" PRIc "\t%7" PRIc "K\t%8" PRIi "K\t%6u\t", 307 i, cnt, SIZE2KB(cnt * (1 << i) * elem_size), SIZE2KB((1 << i) * elem_size), 1 << i); 306 308 if (!list_empty(&b->order[i])) { 307 309 for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) { … … 316 318 } 317 319 printf("-----\t------\t--------\t----------\t---------------\n"); 318 printf("Buddy system contains %zd free elements (%zd blocks)\n" , elem_count, block_count); 319 320 printf("Buddy system contains %" PRIc " free elements (%" PRIc " blocks)\n" , elem_count, block_count); 320 321 } 321 322 -
kernel/generic/src/mm/frame.c
r0f269c2 r2b8b0ca 319 319 zone = (zone_t *) b->data; 320 320 index = frame_index(zone, frame); 321 printf("% zd", index);321 printf("%" PRIi, index); 322 322 } 323 323 … … 845 845 uintptr_t zone_conf_size(count_t count) 846 846 { 847 int size = sizeof(zone_t) + count *sizeof(frame_t);847 int size = sizeof(zone_t) + count * sizeof(frame_t); 848 848 int max_order; 849 849 … … 1160 1160 ipl = interrupts_disable(); 1161 1161 spinlock_lock(&zones.lock); 1162 1163 if (sizeof(void *) == 4) { 1164 printf("# base address free frames busy frames\n"); 1165 printf("-- ------------ ------------ ------------\n"); 1166 } else { 1167 printf("# base address free frames busy frames\n"); 1168 printf("-- -------------------- ------------ ------------\n"); 1169 } 1162 1163 #ifdef __32_BITS__ 1164 printf("# base address free frames busy frames\n"); 1165 printf("-- ------------ ------------ ------------\n"); 1166 #endif 1167 1168 #ifdef __64_BITS__ 1169 printf("# base address free frames busy frames\n"); 1170 printf("-- -------------------- ------------ ------------\n"); 1171 #endif 1170 1172 1171 1173 for (i = 0; i < zones.count; i++) { 1172 1174 zone = zones.info[i]; 1173 1175 spinlock_lock(&zone->lock); 1174 1175 if (sizeof(void *) == 4) 1176 printf("%-2d %#10zx %12zd %12zd\n", i, PFN2ADDR(zone->base), 1177 zone->free_count, zone->busy_count); 1178 else 1179 printf("%-2d %#18zx %12zd %12zd\n", i, PFN2ADDR(zone->base), 1180 zone->free_count, zone->busy_count); 1176 1177 #ifdef __32_BITS__ 1178 printf("%-2u %10p %12" PRIc " %12" PRIc "\n", i, PFN2ADDR(zone->base), 1179 zone->free_count, zone->busy_count); 1180 #endif 1181 1182 #ifdef __64_BITS__ 1183 printf("%-2u %18p %12" PRIc " %12" PRIc "\n", i, PFN2ADDR(zone->base), 1184 zone->free_count, zone->busy_count); 1185 #endif 1181 1186 1182 1187 spinlock_unlock(&zone->lock); … … 1212 1217 spinlock_lock(&zone->lock); 1213 1218 printf("Memory zone information\n"); 1214 printf("Zone base address: %#.*p\n", sizeof(uintptr_t) * 2, 1215 PFN2ADDR(zone->base)); 1216 printf("Zone size: %zd frames (%zd KB)\n", zone->count, 1219 printf("Zone base address: %p\n", PFN2ADDR(zone->base)); 1220 printf("Zone size: %" PRIc " frames (%" PRIs " KB)\n", zone->count, 1217 1221 SIZE2KB(FRAMES2SIZE(zone->count))); 1218 printf("Allocated space: % zd frames (%zdKB)\n", zone->busy_count,1222 printf("Allocated space: %" PRIc " frames (%" PRIs " KB)\n", zone->busy_count, 1219 1223 SIZE2KB(FRAMES2SIZE(zone->busy_count))); 1220 printf("Available space: % zd frames (%zdKB)\n", zone->free_count,1224 printf("Available space: %" PRIc " frames (%" PRIs " KB)\n", zone->free_count, 1221 1225 SIZE2KB(FRAMES2SIZE(zone->free_count))); 1222 1226 buddy_system_structure_print(zone->buddy_system, FRAME_SIZE); -
kernel/generic/src/mm/slab.c
r0f269c2 r2b8b0ca 558 558 ASSERT(_slab_initialized >= 2); 559 559 560 cache->mag_cache = malloc(sizeof(slab_mag_cache_t) *config.cpu_count,0);560 cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,0); 561 561 for (i = 0; i < config.cpu_count; i++) { 562 562 memsetb((uintptr_t)&cache->mag_cache[i], … … 814 814 cache = list_get_instance(cur, slab_cache_t, link); 815 815 816 printf("%-16s %8zd %6zd %6zd %6zd %6zd %9zd %-3s\n", cache->name, cache->size, (1 << cache->order), cache->objects, atomic_get(&cache->allocated_slabs), atomic_get(&cache->cached_objs), atomic_get(&cache->allocated_objs), cache->flags & SLAB_CACHE_SLINSIDE ? "in" : "out"); 816 printf("%-16s %8" PRIs " %6d %6u %6ld %6ld %9ld %-3s\n", 817 cache->name, cache->size, (1 << cache->order), cache->objects, 818 atomic_get(&cache->allocated_slabs), atomic_get(&cache->cached_objs), 819 atomic_get(&cache->allocated_objs), cache->flags & SLAB_CACHE_SLINSIDE ? "in" : "out"); 817 820 } 818 821 spinlock_unlock(&slab_cache_lock); … … 827 830 _slab_cache_create(&mag_cache, 828 831 "slab_magazine", 829 sizeof(slab_magazine_t) +SLAB_MAG_SIZE*sizeof(void*),832 sizeof(slab_magazine_t) + SLAB_MAG_SIZE * sizeof(void*), 830 833 sizeof(uintptr_t), 831 834 NULL, NULL, … … 845 848 846 849 /* Initialize structures for malloc */ 847 for (i=0, size=(1 <<SLAB_MIN_MALLOC_W);848 i < (SLAB_MAX_MALLOC_W -SLAB_MIN_MALLOC_W+1);850 for (i=0, size=(1 << SLAB_MIN_MALLOC_W); 851 i < (SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1); 849 852 i++, size <<= 1) { 850 853 malloc_caches[i] = slab_cache_create(malloc_names[i],
Note:
See TracChangeset
for help on using the changeset viewer.