Changeset bd48f4c in mainline for kernel/generic/src/mm/frame.c


Ignore:
Timestamp:
2010-07-12T10:53:30Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd11d3e
Parents:
c40e6ef (diff), bee2d4c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    rc40e6ef rbd48f4c  
    7575/********************/
    7676
    77 static inline size_t frame_index(zone_t *zone, frame_t *frame)
     77NO_TRACE static inline size_t frame_index(zone_t *zone, frame_t *frame)
    7878{
    7979        return (size_t) (frame - zone->frames);
    8080}
    8181
    82 static inline size_t frame_index_abs(zone_t *zone, frame_t *frame)
     82NO_TRACE static inline size_t frame_index_abs(zone_t *zone, frame_t *frame)
    8383{
    8484        return (size_t) (frame - zone->frames) + zone->base;
    8585}
    8686
    87 static inline bool frame_index_valid(zone_t *zone, size_t index)
     87NO_TRACE static inline bool frame_index_valid(zone_t *zone, size_t index)
    8888{
    8989        return (index < zone->count);
    9090}
    9191
    92 static inline size_t make_frame_index(zone_t *zone, frame_t *frame)
     92NO_TRACE static inline size_t make_frame_index(zone_t *zone, frame_t *frame)
    9393{
    9494        return (frame - zone->frames);
     
    100100 *
    101101 */
    102 static void frame_initialize(frame_t *frame)
     102NO_TRACE static void frame_initialize(frame_t *frame)
    103103{
    104104        frame->refcount = 1;
     
    121121 *
    122122 */
    123 static size_t zones_insert_zone(pfn_t base, size_t count)
     123NO_TRACE static size_t zones_insert_zone(pfn_t base, size_t count)
    124124{
    125125        if (zones.count + 1 == ZONES_MAX) {
     
    133133                if (overlaps(base, count,
    134134                    zones.info[i].base, zones.info[i].count)) {
    135                         printf("Zones overlap!\n");
     135                        printf("Zone (%p, %p) overlaps with zone (%p, %p)!\n",
     136                            PFN2ADDR(base), PFN2ADDR(base + count),
     137                            PFN2ADDR(zones.info[i].base),
     138                            PFN2ADDR(zones.info[i].base + zones.info[i].count));
    136139                        return (size_t) -1;
    137140                }
     
    162165 */
    163166#ifdef CONFIG_DEBUG
    164 static size_t total_frames_free(void)
     167NO_TRACE static size_t total_frames_free(void)
    165168{
    166169        size_t total = 0;
     
    185188 *
    186189 */
    187 size_t find_zone(pfn_t frame, size_t count, size_t hint)
     190NO_TRACE size_t find_zone(pfn_t frame, size_t count, size_t hint)
    188191{
    189192        if (hint >= zones.count)
     
    206209
    207210/** @return True if zone can allocate specified order */
    208 static bool zone_can_alloc(zone_t *zone, uint8_t order)
     211NO_TRACE static bool zone_can_alloc(zone_t *zone, uint8_t order)
    209212{
    210213        return (zone_flags_available(zone->flags)
     
    222225 *
    223226 */
    224 static size_t find_free_zone(uint8_t order, zone_flags_t flags, size_t hint)
     227NO_TRACE static size_t find_free_zone(uint8_t order, zone_flags_t flags,
     228    size_t hint)
    225229{
    226230        if (hint >= zones.count)
     
    262266 *
    263267 */
    264 static link_t *zone_buddy_find_block(buddy_system_t *buddy, link_t *child,
    265     uint8_t order)
     268NO_TRACE static link_t *zone_buddy_find_block(buddy_system_t *buddy,
     269    link_t *child, uint8_t order)
    266270{
    267271        frame_t *frame = list_get_instance(child, frame_t, buddy_link);
     
    285289 *
    286290 */
    287 static link_t *zone_buddy_find_buddy(buddy_system_t *buddy, link_t *block)
     291NO_TRACE static link_t *zone_buddy_find_buddy(buddy_system_t *buddy,
     292    link_t *block)
    288293{
    289294        frame_t *frame = list_get_instance(block, frame_t, buddy_link);
     
    321326 *
    322327 */
    323 static link_t *zone_buddy_bisect(buddy_system_t *buddy, link_t *block)
     328NO_TRACE static link_t *zone_buddy_bisect(buddy_system_t *buddy, link_t *block)
    324329{
    325330        frame_t *frame_l = list_get_instance(block, frame_t, buddy_link);
     
    339344 *
    340345 */
    341 static link_t *zone_buddy_coalesce(buddy_system_t *buddy, link_t *block_1,
    342     link_t *block_2)
     346NO_TRACE static link_t *zone_buddy_coalesce(buddy_system_t *buddy,
     347    link_t *block_1, link_t *block_2)
    343348{
    344349        frame_t *frame1 = list_get_instance(block_1, frame_t, buddy_link);
     
    355360 *
    356361 */
    357 static void zone_buddy_set_order(buddy_system_t *buddy, link_t *block,
     362NO_TRACE static void zone_buddy_set_order(buddy_system_t *buddy, link_t *block,
    358363    uint8_t order)
    359364{
     
    369374 *
    370375 */
    371 static uint8_t zone_buddy_get_order(buddy_system_t *buddy, link_t *block)
     376NO_TRACE static uint8_t zone_buddy_get_order(buddy_system_t *buddy,
     377    link_t *block)
    372378{
    373379        return list_get_instance(block, frame_t, buddy_link)->buddy_order;
     
    380386 *
    381387 */
    382 static void zone_buddy_mark_busy(buddy_system_t *buddy, link_t * block)
     388NO_TRACE static void zone_buddy_mark_busy(buddy_system_t *buddy, link_t *block)
    383389{
    384390        list_get_instance(block, frame_t, buddy_link)->refcount = 1;
     
    389395 * @param buddy Buddy system.
    390396 * @param block Buddy system block.
    391  */
    392 static void zone_buddy_mark_available(buddy_system_t *buddy, link_t *block)
     397 *
     398 */
     399NO_TRACE static void zone_buddy_mark_available(buddy_system_t *buddy,
     400    link_t *block)
    393401{
    394402        list_get_instance(block, frame_t, buddy_link)->refcount = 0;
     
    421429 *
    422430 */
    423 static pfn_t zone_frame_alloc(zone_t *zone, uint8_t order)
     431NO_TRACE static pfn_t zone_frame_alloc(zone_t *zone, uint8_t order)
    424432{
    425433        ASSERT(zone_flags_available(zone->flags));
     
    449457 *
    450458 */
    451 static void zone_frame_free(zone_t *zone, size_t frame_idx)
     459NO_TRACE static void zone_frame_free(zone_t *zone, size_t frame_idx)
    452460{
    453461        ASSERT(zone_flags_available(zone->flags));
     
    470478
    471479/** Return frame from zone. */
    472 static frame_t *zone_get_frame(zone_t *zone, size_t frame_idx)
     480NO_TRACE static frame_t *zone_get_frame(zone_t *zone, size_t frame_idx)
    473481{
    474482        ASSERT(frame_idx < zone->count);
     
    477485
    478486/** Mark frame in zone unavailable to allocation. */
    479 static void zone_mark_unavailable(zone_t *zone, size_t frame_idx)
     487NO_TRACE static void zone_mark_unavailable(zone_t *zone, size_t frame_idx)
    480488{
    481489        ASSERT(zone_flags_available(zone->flags));
     
    506514 *
    507515 */
    508 static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1, buddy_system_t *buddy)
     516NO_TRACE static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1,
     517    buddy_system_t *buddy)
    509518{
    510519        ASSERT(zone_flags_available(zones.info[z1].flags));
     
    602611 *
    603612 */
    604 static void return_config_frames(size_t znum, pfn_t pfn, size_t count)
     613NO_TRACE static void return_config_frames(size_t znum, pfn_t pfn, size_t count)
    605614{
    606615        ASSERT(zone_flags_available(zones.info[znum].flags));
     
    637646 *
    638647 */
    639 static void zone_reduce_region(size_t znum, pfn_t frame_idx, size_t count)
     648NO_TRACE static void zone_reduce_region(size_t znum, pfn_t frame_idx,
     649    size_t count)
    640650{
    641651        ASSERT(zone_flags_available(zones.info[znum].flags));
     
    777787 *
    778788 */
    779 static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start,
    780     size_t count, zone_flags_t flags)
     789NO_TRACE static void zone_construct(zone_t *zone, buddy_system_t *buddy,
     790    pfn_t start, size_t count, zone_flags_t flags)
    781791{
    782792        zone->base = start;
     
    821831 *
    822832 */
    823 uintptr_t zone_conf_size(size_t count)
     833size_t zone_conf_size(size_t count)
    824834{
    825835        return (count * sizeof(frame_t) + buddy_conf_size(fnzb(count)));
     
    11081118 *
    11091119 */
    1110 void frame_reference_add(pfn_t pfn)
     1120NO_TRACE void frame_reference_add(pfn_t pfn)
    11111121{
    11121122        irq_spinlock_lock(&zones.lock, true);
     
    11271137 *
    11281138 */
    1129 void frame_mark_unavailable(pfn_t start, size_t count)
     1139NO_TRACE void frame_mark_unavailable(pfn_t start, size_t count)
    11301140{
    11311141        irq_spinlock_lock(&zones.lock, true);
     
    12341244{
    12351245#ifdef __32_BITS__
    1236         printf("#  base address frames       flags    free frames  busy frames\n");
    1237         printf("-- ------------ ------------ -------- ------------ ------------\n");
     1246        printf("[nr] [base addr] [frames    ] [flags ] [free frames ] [busy frames ]\n");
    12381247#endif
    12391248
    12401249#ifdef __64_BITS__
    1241         printf("#  base address          frames      flags    free frames  busy frames\n");
    1242         printf("-- -------------------- ------------ -------- ------------ ------------\n");
     1250        printf("[nr] [base address    ] [frames    ] [flags ] [free frames ] [busy frames ]\n");
    12431251#endif
    12441252       
     
    12731281                bool available = zone_flags_available(flags);
    12741282               
    1275                 printf("%-2" PRIs, i);
     1283                printf("%-4" PRIs, i);
    12761284               
    12771285#ifdef __32_BITS__
    1278                 printf("   %10p", base);
     1286                printf("  %10p", base);
    12791287#endif
    12801288               
    12811289#ifdef __64_BITS__
    1282                 printf("   %18p", base);
     1290                printf(" %18p", base);
    12831291#endif
    12841292               
     
    12891297               
    12901298                if (available)
    1291                         printf("%12" PRIs " %12" PRIs,
     1299                        printf("%14" PRIs " %14" PRIs,
    12921300                            free_count, busy_count);
    12931301               
Note: See TracChangeset for help on using the changeset viewer.