Changes in kernel/generic/src/mm/frame.c [74c5a1ca:97bdb4a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/frame.c
r74c5a1ca r97bdb4a 75 75 /********************/ 76 76 77 static inline size_t frame_index(zone_t *zone, frame_t *frame)77 NO_TRACE static inline size_t frame_index(zone_t *zone, frame_t *frame) 78 78 { 79 79 return (size_t) (frame - zone->frames); 80 80 } 81 81 82 static inline size_t frame_index_abs(zone_t *zone, frame_t *frame)82 NO_TRACE static inline size_t frame_index_abs(zone_t *zone, frame_t *frame) 83 83 { 84 84 return (size_t) (frame - zone->frames) + zone->base; 85 85 } 86 86 87 static inline bool frame_index_valid(zone_t *zone, size_t index)87 NO_TRACE static inline bool frame_index_valid(zone_t *zone, size_t index) 88 88 { 89 89 return (index < zone->count); 90 90 } 91 91 92 static inline size_t make_frame_index(zone_t *zone, frame_t *frame)92 NO_TRACE static inline size_t make_frame_index(zone_t *zone, frame_t *frame) 93 93 { 94 94 return (frame - zone->frames); … … 100 100 * 101 101 */ 102 static void frame_initialize(frame_t *frame)102 NO_TRACE static void frame_initialize(frame_t *frame) 103 103 { 104 104 frame->refcount = 1; … … 121 121 * 122 122 */ 123 static size_t zones_insert_zone(pfn_t base, size_t count)123 NO_TRACE static size_t zones_insert_zone(pfn_t base, size_t count) 124 124 { 125 125 if (zones.count + 1 == ZONES_MAX) { … … 133 133 if (overlaps(base, count, 134 134 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)); 136 139 return (size_t) -1; 137 140 } … … 162 165 */ 163 166 #ifdef CONFIG_DEBUG 164 static size_t total_frames_free(void)167 NO_TRACE static size_t total_frames_free(void) 165 168 { 166 169 size_t total = 0; … … 185 188 * 186 189 */ 187 size_t find_zone(pfn_t frame, size_t count, size_t hint)190 NO_TRACE size_t find_zone(pfn_t frame, size_t count, size_t hint) 188 191 { 189 192 if (hint >= zones.count) … … 206 209 207 210 /** @return True if zone can allocate specified order */ 208 static bool zone_can_alloc(zone_t *zone, uint8_t order)211 NO_TRACE static bool zone_can_alloc(zone_t *zone, uint8_t order) 209 212 { 210 213 return (zone_flags_available(zone->flags) … … 222 225 * 223 226 */ 224 static size_t find_free_zone(uint8_t order, zone_flags_t flags, size_t hint) 227 NO_TRACE static size_t find_free_zone(uint8_t order, zone_flags_t flags, 228 size_t hint) 225 229 { 226 230 if (hint >= zones.count) … … 262 266 * 263 267 */ 264 static link_t *zone_buddy_find_block(buddy_system_t *buddy, link_t *child,265 uint8_t order)268 NO_TRACE static link_t *zone_buddy_find_block(buddy_system_t *buddy, 269 link_t *child, uint8_t order) 266 270 { 267 271 frame_t *frame = list_get_instance(child, frame_t, buddy_link); … … 285 289 * 286 290 */ 287 static link_t *zone_buddy_find_buddy(buddy_system_t *buddy, link_t *block) 291 NO_TRACE static link_t *zone_buddy_find_buddy(buddy_system_t *buddy, 292 link_t *block) 288 293 { 289 294 frame_t *frame = list_get_instance(block, frame_t, buddy_link); … … 321 326 * 322 327 */ 323 static link_t *zone_buddy_bisect(buddy_system_t *buddy, link_t *block)328 NO_TRACE static link_t *zone_buddy_bisect(buddy_system_t *buddy, link_t *block) 324 329 { 325 330 frame_t *frame_l = list_get_instance(block, frame_t, buddy_link); … … 339 344 * 340 345 */ 341 static link_t *zone_buddy_coalesce(buddy_system_t *buddy, link_t *block_1,342 link_t *block_ 2)346 NO_TRACE static link_t *zone_buddy_coalesce(buddy_system_t *buddy, 347 link_t *block_1, link_t *block_2) 343 348 { 344 349 frame_t *frame1 = list_get_instance(block_1, frame_t, buddy_link); … … 355 360 * 356 361 */ 357 static void zone_buddy_set_order(buddy_system_t *buddy, link_t *block,362 NO_TRACE static void zone_buddy_set_order(buddy_system_t *buddy, link_t *block, 358 363 uint8_t order) 359 364 { … … 369 374 * 370 375 */ 371 static uint8_t zone_buddy_get_order(buddy_system_t *buddy, link_t *block) 376 NO_TRACE static uint8_t zone_buddy_get_order(buddy_system_t *buddy, 377 link_t *block) 372 378 { 373 379 return list_get_instance(block, frame_t, buddy_link)->buddy_order; … … 380 386 * 381 387 */ 382 static void zone_buddy_mark_busy(buddy_system_t *buddy, link_t *block)388 NO_TRACE static void zone_buddy_mark_busy(buddy_system_t *buddy, link_t *block) 383 389 { 384 390 list_get_instance(block, frame_t, buddy_link)->refcount = 1; … … 389 395 * @param buddy Buddy system. 390 396 * @param block Buddy system block. 391 */ 392 static void zone_buddy_mark_available(buddy_system_t *buddy, link_t *block) 397 * 398 */ 399 NO_TRACE static void zone_buddy_mark_available(buddy_system_t *buddy, 400 link_t *block) 393 401 { 394 402 list_get_instance(block, frame_t, buddy_link)->refcount = 0; … … 421 429 * 422 430 */ 423 static pfn_t zone_frame_alloc(zone_t *zone, uint8_t order)431 NO_TRACE static pfn_t zone_frame_alloc(zone_t *zone, uint8_t order) 424 432 { 425 433 ASSERT(zone_flags_available(zone->flags)); … … 449 457 * 450 458 */ 451 static void zone_frame_free(zone_t *zone, size_t frame_idx)459 NO_TRACE static void zone_frame_free(zone_t *zone, size_t frame_idx) 452 460 { 453 461 ASSERT(zone_flags_available(zone->flags)); … … 470 478 471 479 /** Return frame from zone. */ 472 static frame_t *zone_get_frame(zone_t *zone, size_t frame_idx)480 NO_TRACE static frame_t *zone_get_frame(zone_t *zone, size_t frame_idx) 473 481 { 474 482 ASSERT(frame_idx < zone->count); … … 477 485 478 486 /** Mark frame in zone unavailable to allocation. */ 479 static void zone_mark_unavailable(zone_t *zone, size_t frame_idx)487 NO_TRACE static void zone_mark_unavailable(zone_t *zone, size_t frame_idx) 480 488 { 481 489 ASSERT(zone_flags_available(zone->flags)); … … 506 514 * 507 515 */ 508 static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1, buddy_system_t *buddy) 516 NO_TRACE static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1, 517 buddy_system_t *buddy) 509 518 { 510 519 ASSERT(zone_flags_available(zones.info[z1].flags)); … … 602 611 * 603 612 */ 604 static void return_config_frames(size_t znum, pfn_t pfn, size_t count)613 NO_TRACE static void return_config_frames(size_t znum, pfn_t pfn, size_t count) 605 614 { 606 615 ASSERT(zone_flags_available(zones.info[znum].flags)); … … 637 646 * 638 647 */ 639 static void zone_reduce_region(size_t znum, pfn_t frame_idx, size_t count) 648 NO_TRACE static void zone_reduce_region(size_t znum, pfn_t frame_idx, 649 size_t count) 640 650 { 641 651 ASSERT(zone_flags_available(zones.info[znum].flags)); … … 777 787 * 778 788 */ 779 static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start,780 size_t count, zone_flags_t flags)789 NO_TRACE static void zone_construct(zone_t *zone, buddy_system_t *buddy, 790 pfn_t start, size_t count, zone_flags_t flags) 781 791 { 782 792 zone->base = start; … … 821 831 * 822 832 */ 823 uintptr_t zone_conf_size(size_t count)833 size_t zone_conf_size(size_t count) 824 834 { 825 835 return (count * sizeof(frame_t) + buddy_conf_size(fnzb(count))); … … 1108 1118 * 1109 1119 */ 1110 void frame_reference_add(pfn_t pfn)1120 NO_TRACE void frame_reference_add(pfn_t pfn) 1111 1121 { 1112 1122 irq_spinlock_lock(&zones.lock, true); … … 1127 1137 * 1128 1138 */ 1129 void frame_mark_unavailable(pfn_t start, size_t count)1139 NO_TRACE void frame_mark_unavailable(pfn_t start, size_t count) 1130 1140 { 1131 1141 irq_spinlock_lock(&zones.lock, true);
Note:
See TracChangeset
for help on using the changeset viewer.