Changeset dfd9186 in mainline for generic/src/mm/frame.c


Ignore:
Timestamp:
2006-01-04T18:35:07Z (19 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
96cacc1
Parents:
5fe5f1e
Message:

Memory zones console command implementation. todo: buddy allocator structures.

File:
1 edited

Legend:

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

    r5fe5f1e rdfd9186  
    483483        frame->refcount = 1;
    484484}
     485
     486
     487void zone_print_list(void) {
     488        zone_t *zone = NULL;
     489        link_t *cur;
     490        index_t i = 0;
     491        printf("No.\tBase address\tFree Frames\tBusy Frames\n");
     492        printf("---\t------------\t-----------\t-----------\n");
     493        for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
     494                zone = list_get_instance(cur, zone_t, link);
     495                printf("%d\t%L\t%d\t\t%d\n",i++,zone->base, zone->free_count, zone->busy_count);
     496        }
     497
     498}
     499
     500void zone_print_one(index_t zone_index) {
     501        zone_t *zone = NULL;
     502        link_t *cur;
     503        index_t i = 0;
     504       
     505        for (cur = zone_head.next; cur != &zone_head; cur = cur->next) {
     506                if (i == zone_index) {
     507                        zone = list_get_instance(cur, zone_t, link);
     508                        break;
     509                }
     510                i++;
     511        }
     512       
     513        if (!zone) {
     514                printf("No zone with index %d\n", zone_index);
     515                return;
     516        }
     517       
     518        printf("Memory zone %d information\n\n", zone_index);
     519        printf("Zone base address: %P\n", zone->base);
     520        printf("Zone size: %d frames (%d kbytes)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10);
     521        printf("Allocated space: %d frames (%d kbytes)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);
     522        printf("Available space: %d (%d kbytes)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);
     523        printf("Buddy allocator structures: not implemented\n");
     524}
     525
Note: See TracChangeset for help on using the changeset viewer.