Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 675 → Rev 676

/kernel/trunk/generic/include/mm/frame.h
108,4 → 108,11
extern frame_t *frame_reference(frame_t *frame);
extern void frame_release(frame_t *frame);
 
 
/*
* Console functions
*/
extern void zone_print_list(void);
extern void zone_print_one(index_t index);
 
#endif
/kernel/trunk/generic/src/console/cmd.c
254,11 → 254,11
 
/** Data and methods for 'zone' command */
static int cmd_zone(cmd_arg_t *argv);
static char zone_buf[MAX_CMDLINE+1];
//static char zone_buf[sizeof(__native)];
static cmd_arg_t zone_argv = {
.type = ARG_TYPE_INT,
.buffer = zone_buf,
.len = sizeof(zone_buf)
//.buffer = zone_buf,
.len = sizeof(__native)
};
 
static cmd_info_t zone_info = {
607,12 → 607,12
}
 
int cmd_zones(cmd_arg_t * argv) {
printf("Zones listing not implemented\n");
zone_print_list();
return 1;
}
 
int cmd_zone(cmd_arg_t * argv) {
printf("Zone details not implemented\n");
zone_print_one(argv[0].intval);
return 1;
}
 
/kernel/trunk/generic/src/mm/frame.c
482,3 → 482,44
frame = list_get_instance(block, frame_t, buddy_link);
frame->refcount = 1;
}
 
 
void zone_print_list(void) {
zone_t *zone = NULL;
link_t *cur;
index_t i = 0;
printf("No.\tBase address\tFree Frames\tBusy Frames\n");
printf("---\t------------\t-----------\t-----------\n");
for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
zone = list_get_instance(cur, zone_t, link);
printf("%d\t%L\t%d\t\t%d\n",i++,zone->base, zone->free_count, zone->busy_count);
}
 
}
 
void zone_print_one(index_t zone_index) {
zone_t *zone = NULL;
link_t *cur;
index_t i = 0;
for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
if (i == zone_index) {
zone = list_get_instance(cur, zone_t, link);
break;
}
i++;
}
if (!zone) {
printf("No zone with index %d\n", zone_index);
return;
}
printf("Memory zone %d information\n\n", zone_index);
printf("Zone base address: %P\n", zone->base);
printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10);
printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
printf("Buddy allocator structures: not implemented\n");
}