Changeset eef75f6 in mainline
- Timestamp:
- 2005-12-05T19:09:14Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95498e5
- Parents:
- 61e6c39
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia64/Makefile.inc
r61e6c39 reef75f6 39 39 # 40 40 41 CFLAGS += -mconstant-gp -fno-unwind-tables -minline-int-divide-min-latency41 CFLAGS += -mconstant-gp -fno-unwind-tables 42 42 LFLAGS += -EL 43 43 AFLAGS += -mconstant-gp -
generic/include/mm/frame.h
r61e6c39 reef75f6 54 54 __address base; /**< physical address of the first frame in the frames array */ 55 55 frame_t *frames; /**< array of frame_t structures in this zone */ 56 count_t free_count; /**< number of fr ame_t structures in free list*/57 count_t busy_count; /**< number of frame_t structures not in free list*/56 count_t free_count; /**< number of free frame_t structures */ 57 count_t busy_count; /**< number of busy frame_t structures */ 58 58 59 59 buddy_system_t * buddy_system; /**< buddy system for the zone */ -
generic/src/mm/frame.c
r61e6c39 reef75f6 44 44 link_t zone_head; /**< list of all zones in the system */ 45 45 46 /** Blacklist containing non-available areas of memory. 47 * 48 * This blacklist is used to exclude frames that cannot be allocated 49 * (e.g. kernel memory) from available memory map. 50 */ 46 51 region_t zone_blacklist[ZONE_BLACKLIST_SIZE]; 47 52 count_t zone_blacklist_count = 0; … … 123 128 124 129 /* Allocate frames from zone buddy system */ 125 cur = buddy_system_alloc(zone->buddy_system, order); 126 127 /* frame will be actually a first frame of the block */ 128 frame = list_get_instance(cur, frame_t, buddy_link); 130 tmp = buddy_system_alloc(zone->buddy_system, order); 131 132 ASSERT(tmp); 133 134 /* Update zone information. */ 135 zone->free_count -= (1 << order); 136 zone->busy_count += (1 << order); 137 138 /* Frame will be actually a first frame of the block. */ 139 frame = list_get_instance(tmp, frame_t, buddy_link); 129 140 130 141 /* get frame address */ 131 142 v = FRAME2ADDR(zone, frame); 132 143 133 if (flags & FRAME_KA)134 v = PA2KA(v);135 136 144 spinlock_unlock(&zone->lock); 137 145 spinlock_unlock(&zone_head_lock); 138 146 interrupts_restore(ipl); 147 148 149 if (flags & FRAME_KA) 150 v = PA2KA(v); 151 139 152 return v; 140 141 153 } 142 154 … … 191 203 buddy_system_free(zone->buddy_system, &frame->buddy_link); 192 204 } 193 194 spinlock_unlock(&zone->lock); 195 205 206 /* Update zone information. */ 207 zone->free_count += (1 << frame->buddy_order); 208 zone->busy_count -= (1 << frame->buddy_order); 209 210 spinlock_unlock(&zone->lock); 196 211 spinlock_unlock(&zone_head_lock); 197 212 interrupts_restore(ipl); … … 231 246 } 232 247 233 248 /** Create frame zones in region of available memory. 249 * 250 * Avoid any black listed areas of non-available memory. 251 * Assume that the black listed areas cannot overlap 252 * one another or cross available memory region boundaries. 253 * 254 * @param base Base address of available memory region. 255 * @param size Size of the region. 256 */ 234 257 void zone_create_in_region(__address base, size_t size) { 235 258 int i; … … 269 292 270 293 271 272 294 /** Create frame zone 273 295 * … … 374 396 */ 375 397 link_t * zone_buddy_find_buddy(buddy_system_t *b, link_t * block) { 376 frame_t * frame , * f;398 frame_t * frame; 377 399 zone_t * zone; 378 link_t * cur;379 400 count_t index; 380 401 bool is_left, is_right; … … 383 404 zone = (zone_t *) b->data; 384 405 385 /*386 * (FRAME_INDEX % 2^(ORDER+1)) == 0 ===> LEFT BUDDY387 * (FRAME_INDEX % 2^(ORDER+1)) == 2^(ORDER) ===> RIGHT BUDDY388 */389 390 406 is_left = IS_BUDDY_LEFT_BLOCK(zone, frame); 391 407 is_right = !is_left; … … 407 423 } 408 424 409 return NULL; 410 425 return NULL; 411 426 } 412 427
Note:
See TracChangeset
for help on using the changeset viewer.