Changeset b87f418 in mainline for generic/src/mm/frame.c
- Timestamp:
- 2005-12-07T23:00:30Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f62355a
- Parents:
- 4acac843
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/mm/frame.c
r4acac843 rb87f418 1 1 /* 2 * Copyright (C) 2001-2004 Jakub Jermar 2 * Copyright (C) 2001-2005 Jakub Jermar 3 * Copyright (C) 2005 Sergey Bondari 3 4 * All rights reserved. 4 5 * … … 226 227 227 228 /* Force base to the nearest lower address frame boundary. */ 228 base &= ~(FRAME_SIZE - 1);229 base = ALIGN_DOWN(base, FRAME_SIZE); 229 230 /* Align size to frame boundary. */ 230 size = ALIGN (size, FRAME_SIZE);231 232 ASSERT( zone_blacklist_count <=ZONE_BLACKLIST_SIZE);231 size = ALIGN_UP(size, FRAME_SIZE); 232 233 ASSERT(index < ZONE_BLACKLIST_SIZE); 233 234 zone_blacklist[index].base = base; 234 235 zone_blacklist[index].size = size; … … 285 286 286 287 if (!z) { 287 panic("Cannot allocate zone ( %dB).\n", size);288 panic("Cannot allocate zone (base=%P, size=%d).\n", base, size); 288 289 } 289 290 … … 394 395 frame_t * frame; 395 396 zone_t * zone; 396 count_t index;397 index_t index; 397 398 bool is_left, is_right; 398 399 … … 400 401 zone = (zone_t *) b->data; 401 402 403 ASSERT(IS_BUDDY_ORDER_OK(FRAME_INDEX(zone, frame), frame->buddy_order)); 404 402 405 is_left = IS_BUDDY_LEFT_BLOCK(zone, frame); 403 is_right = !is_left; 404 405 /* 406 * test left buddy 407 */ 406 is_right = IS_BUDDY_RIGHT_BLOCK(zone, frame); 407 408 ASSERT(is_left ^ is_right); 409 408 410 if (is_left) { 409 411 index = (FRAME_INDEX(zone, frame)) + (1 << frame->buddy_order); … … 431 433 link_t * zone_buddy_bisect(buddy_system_t *b, link_t * block) { 432 434 frame_t * frame_l, * frame_r; 435 433 436 frame_l = list_get_instance(block, frame_t, buddy_link); 434 437 frame_r = (frame_l + (1 << (frame_l->buddy_order - 1))); 438 435 439 return &frame_r->buddy_link; 436 440 } … … 446 450 link_t * zone_buddy_coalesce(buddy_system_t *b, link_t * block_1, link_t * block_2) { 447 451 frame_t * frame1, * frame2; 452 448 453 frame1 = list_get_instance(block_1, frame_t, buddy_link); 449 454 frame2 = list_get_instance(block_2, frame_t, buddy_link); 455 450 456 return frame1 < frame2 ? block_1 : block_2; 451 457 }
Note:
See TracChangeset
for help on using the changeset viewer.