Subversion Repositories HelenOS

Rev

Rev 3205 | Rev 3207 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3205 Rev 3206
Line 316... Line 316...
316
        }
316
        }
317
    } while(index-- > 0);
317
    } while(index-- > 0);
318
    return NULL;
318
    return NULL;
319
}
319
}
320
 
320
 
321
static void zone_buddy_print_id(buddy_system_t *b, link_t *block)
-
 
322
{
-
 
323
    frame_t *frame;
-
 
324
    zone_t *zone;
-
 
325
    index_t index;
-
 
326
 
-
 
327
    frame = list_get_instance(block, frame_t, buddy_link);
-
 
328
    zone = (zone_t *) b->data;
-
 
329
    index = frame_index(zone, frame);
-
 
330
    printf("%" PRIi, index);
-
 
331
}                    
-
 
332
 
-
 
333
/** Buddy system find_buddy implementation.
321
/** Buddy system find_buddy implementation.
334
 *
322
 *
335
 * @param b     Buddy system.
323
 * @param b     Buddy system.
336
 * @param block     Block for which buddy should be found.
324
 * @param block     Block for which buddy should be found.
337
 *
325
 *
Line 467... Line 455...
467
    .coalesce = zone_buddy_coalesce,
455
    .coalesce = zone_buddy_coalesce,
468
    .set_order = zone_buddy_set_order,
456
    .set_order = zone_buddy_set_order,
469
    .get_order = zone_buddy_get_order,
457
    .get_order = zone_buddy_get_order,
470
    .mark_busy = zone_buddy_mark_busy,
458
    .mark_busy = zone_buddy_mark_busy,
471
    .mark_available = zone_buddy_mark_available,
459
    .mark_available = zone_buddy_mark_available,
472
    .find_block = zone_buddy_find_block,
460
    .find_block = zone_buddy_find_block
473
    .print_id = zone_buddy_print_id
-
 
474
};
461
};
475
 
462
 
476
/******************/
463
/******************/
477
/* Zone functions */
464
/* Zone functions */
478
/******************/
465
/******************/
Line 1281... Line 1268...
1281
void zone_print_one(unsigned int num)
1268
void zone_print_one(unsigned int num)
1282
{
1269
{
1283
    zone_t *zone = NULL;
1270
    zone_t *zone = NULL;
1284
    ipl_t ipl;
1271
    ipl_t ipl;
1285
    unsigned int i;
1272
    unsigned int i;
-
 
1273
    uintptr_t base;
-
 
1274
    count_t count;
-
 
1275
    count_t busy_count;
-
 
1276
    count_t free_count;
1286
 
1277
 
1287
    ipl = interrupts_disable();
1278
    ipl = interrupts_disable();
1288
    spinlock_lock(&zones.lock);
1279
    spinlock_lock(&zones.lock);
1289
 
1280
 
1290
    for (i = 0; i < zones.count; i++) {
1281
    for (i = 0; i < zones.count; i++) {
Line 1292... Line 1283...
1292
            zone = zones.info[i];
1283
            zone = zones.info[i];
1293
            break;
1284
            break;
1294
        }
1285
        }
1295
    }
1286
    }
1296
    if (!zone) {
1287
    if (!zone) {
-
 
1288
        spinlock_unlock(&zones.lock);
-
 
1289
        interrupts_restore(ipl);
1297
        printf("Zone not found.\n");
1290
        printf("Zone not found.\n");
1298
        goto out;
1291
        return;
1299
    }
1292
    }
1300
   
1293
   
1301
    spinlock_lock(&zone->lock);
1294
    spinlock_lock(&zone->lock);
1302
    printf("Memory zone information\n");
-
 
1303
    printf("Zone base address: %p\n", PFN2ADDR(zone->base));
1295
    base = PFN2ADDR(zone->base);
1304
    printf("Zone size: %" PRIc " frames (%" PRIs " KB)\n", zone->count,
-
 
1305
        SIZE2KB(FRAMES2SIZE(zone->count)));
1296
    count = zone->count;
1306
    printf("Allocated space: %" PRIc " frames (%" PRIs " KB)\n",
-
 
1307
        zone->busy_count, SIZE2KB(FRAMES2SIZE(zone->busy_count)));
1297
    busy_count = zone->busy_count;
1308
    printf("Available space: %" PRIc " frames (%" PRIs " KB)\n",
-
 
1309
        zone->free_count, SIZE2KB(FRAMES2SIZE(zone->free_count)));
1298
    free_count = zone->free_count;
1310
    buddy_system_structure_print(zone->buddy_system, FRAME_SIZE);
-
 
1311
    spinlock_unlock(&zone->lock);
1299
    spinlock_unlock(&zone->lock);
1312
   
-
 
1313
out:
-
 
1314
    spinlock_unlock(&zones.lock);
1300
    spinlock_unlock(&zones.lock);
1315
    interrupts_restore(ipl);
1301
    interrupts_restore(ipl);
-
 
1302
 
-
 
1303
    printf("Zone base address: %p\n", base);
-
 
1304
    printf("Zone size: %" PRIc " frames (%" PRIs " KiB)\n", count,
-
 
1305
        SIZE2KB(FRAMES2SIZE(count)));
-
 
1306
    printf("Allocated space: %" PRIc " frames (%" PRIs " KiB)\n",
-
 
1307
        busy_count, SIZE2KB(FRAMES2SIZE(busy_count)));
-
 
1308
    printf("Available space: %" PRIc " frames (%" PRIs " KiB)\n",
-
 
1309
        free_count, SIZE2KB(FRAMES2SIZE(free_count)));
1316
}
1310
}
1317
 
1311
 
1318
/** @}
1312
/** @}
1319
 */
1313
 */
1320
 
1314