Rev 677 | Rev 686 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 677 | Rev 683 | ||
---|---|---|---|
Line 488... | Line 488... | ||
488 | */ |
488 | */ |
489 | void zone_print_list(void) { |
489 | void zone_print_list(void) { |
490 | zone_t *zone = NULL; |
490 | zone_t *zone = NULL; |
491 | link_t *cur; |
491 | link_t *cur; |
492 | index_t i = 0; |
492 | index_t i = 0; |
- | 493 | spinlock_lock(&zone_head_lock); |
|
493 | printf("No.\tBase address\tFree Frames\tBusy Frames\n"); |
494 | printf("No.\tBase address\tFree Frames\tBusy Frames\n"); |
494 | printf("---\t------------\t-----------\t-----------\n"); |
495 | printf("---\t------------\t-----------\t-----------\n"); |
495 | for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
496 | for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
496 | zone = list_get_instance(cur, zone_t, link); |
497 | zone = list_get_instance(cur, zone_t, link); |
- | 498 | spinlock_lock(&zone->lock); |
|
497 | printf("%d\t%L\t%d\t\t%d\n",i++,zone->base, zone->free_count, zone->busy_count); |
499 | printf("%d\t%L\t%d\t\t%d\n",i++,zone->base, zone->free_count, zone->busy_count); |
498 | } |
500 | } |
- | 501 | spinlock_unlock(&zone_head_lock); |
|
499 | 502 | ||
500 | } |
503 | } |
501 | 504 | ||
502 | /** Prints zone details |
505 | /** Prints zone details |
503 | * |
506 | * |
504 | * @param zone_index Zone order in zones list (0 is the first zone) |
507 | * @param base Zone base address |
505 | */ |
508 | */ |
506 | void zone_print_one(index_t zone_index) { |
509 | void zone_print_one(__address base) { |
507 | zone_t *zone = NULL; |
510 | zone_t *zone = NULL, *z ; |
508 | link_t *cur; |
511 | link_t *cur; |
- | 512 | ||
- | 513 | ||
509 | index_t i = 0; |
514 | spinlock_lock(&zone_head_lock); |
- | 515 | ||
510 | 516 | ||
511 | for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
517 | for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
- | 518 | z = list_get_instance(cur, zone_t, link); |
|
512 | if (i == zone_index) { |
519 | if (base == z->base) { |
513 | zone = list_get_instance(cur, zone_t, link); |
520 | zone = z; |
514 | break; |
521 | break; |
515 | } |
522 | } |
516 | i++; |
- | |
517 | } |
523 | } |
518 | 524 | ||
- | 525 | ||
519 | if (!zone) { |
526 | if (!zone) { |
520 | printf("No zone with index %d\n", zone_index); |
527 | printf("No zone with address %X\n", base); |
521 | return; |
528 | return; |
522 | } |
529 | } |
523 | 530 | ||
- | 531 | spinlock_lock(&zone->lock); |
|
524 | printf("Memory zone %d information\n\n", zone_index); |
532 | printf("Memory zone information\n\n"); |
525 | printf("Zone base address: %P\n", zone->base); |
533 | printf("Zone base address: %P\n", zone->base); |
526 | printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10); |
534 | printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10); |
527 | printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10); |
535 | printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10); |
528 | printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10); |
536 | printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10); |
- | 537 | ||
529 | printf("Buddy allocator structures: not implemented\n"); |
538 | printf("\nBuddy allocator structures:\n\n"); |
- | 539 | buddy_system_structure_print(zone->buddy_system); |
|
- | 540 | ||
- | 541 | ||
- | 542 | spinlock_unlock(&zone->lock); |
|
- | 543 | spinlock_unlock(&zone_head_lock); |
|
- | 544 | ||
530 | } |
545 | } |
531 | 546 |