Changeset 566ba81 in mainline for generic/src/mm/frame.c


Ignore:
Timestamp:
2006-01-08T14:43:52Z (19 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6d7ffa65
Parents:
2fe2046c
Message:

Console command 'zone' now takes zone address as parameter.
Added buddy system statistics into the 'zone' command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/mm/frame.c

    r2fe2046c r566ba81  
    491491        link_t *cur;
    492492        index_t i = 0;
     493        spinlock_lock(&zone_head_lock);
    493494        printf("No.\tBase address\tFree Frames\tBusy Frames\n");
    494495        printf("---\t------------\t-----------\t-----------\n");
    495496        for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
    496497                zone = list_get_instance(cur, zone_t, link);
     498                spinlock_lock(&zone->lock);
    497499                printf("%d\t%L\t%d\t\t%d\n",i++,zone->base, zone->free_count, zone->busy_count);
    498500        }
     501        spinlock_unlock(&zone_head_lock);
    499502
    500503}
     
    502505/** Prints zone details
    503506 *
    504  * @param zone_index Zone order in zones list (0 is the first zone)
    505  */
    506 void zone_print_one(index_t zone_index) {
    507         zone_t *zone = NULL;
     507 * @param base Zone base address
     508 */
     509void zone_print_one(__address base) {
     510        zone_t *zone = NULL, *z ;
    508511        link_t *cur;
    509         index_t i = 0;
     512       
     513       
     514        spinlock_lock(&zone_head_lock);
     515       
    510516       
    511517        for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
    512                 if (i == zone_index) {
    513                         zone = list_get_instance(cur, zone_t, link);
     518                z = list_get_instance(cur, zone_t, link);
     519                if (base == z->base) {
     520                        zone = z;
    514521                        break;
    515522                }
    516                 i++;
    517         }
     523        }
     524       
    518525       
    519526        if (!zone) {
    520                 printf("No zone with index %d\n", zone_index);
     527                printf("No zone with address %X\n", base);
    521528                return;
    522529        }
    523530       
    524         printf("Memory zone %d information\n\n", zone_index);
     531        spinlock_lock(&zone->lock);
     532        printf("Memory zone information\n\n");
    525533        printf("Zone base address: %P\n", zone->base);
    526534        printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10);
    527535        printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
    528536        printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
    529         printf("Buddy allocator structures: not implemented\n");
    530 }
    531 
     537       
     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       
     545}
     546
Note: See TracChangeset for help on using the changeset viewer.