Changeset 4457455 in mainline for generic/src/mm/frame.c
- Timestamp:
- 2005-12-05T17:02:40Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 61e6c39
- Parents:
- 9ebc238
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/mm/frame.c
r9ebc238 r4457455 64 64 if (config.cpu_active == 1) { 65 65 zone_init(); 66 frame_region_not_free( config.base, config.kernel_size);66 frame_region_not_free(KA2PA(config.base), config.kernel_size); 67 67 } 68 68 … … 70 70 } 71 71 72 /** Allocate a frame 73 * 74 * Allocate a frame of physical memory. 72 /** Allocate power-of-two frames of physical memory. 75 73 * 76 74 * @param flags Flags for host zone selection and address processing. 75 * @param order Allocate exactly 2^order frames. 77 76 * 78 77 * @return Allocated frame. … … 203 202 * Mark frame region not free. 204 203 * 205 * @param start First address.206 * @param s top Last address.204 * @param base Base address of non-available region. 205 * @param size Size of non-available region. 207 206 */ 208 207 void frame_region_not_free(__address base, size_t size) 209 208 { 210 count_t index;209 index_t index; 211 210 index = zone_blacklist_count++; 212 ASSERT(base % FRAME_SIZE == 0); 213 214 if (size % FRAME_SIZE != 0) {215 size = ALIGN(size, FRAME_SIZE);216 }217 ASSERT(size % FRAME_SIZE == 0); 211 212 /* Force base to the nearest lower address frame boundary. */ 213 base &= ~(FRAME_SIZE - 1); 214 /* Align size to frame boundary. */ 215 size = ALIGN(size, FRAME_SIZE); 216 218 217 ASSERT(zone_blacklist_count <= ZONE_BLACKLIST_SIZE); 219 218 zone_blacklist[index].base = base; … … 236 235 int i; 237 236 zone_t * z; 238 __address s; size_t sz; 237 __address s; 238 size_t sz; 239 239 240 240 ASSERT(base % FRAME_SIZE == 0); 241 241 ASSERT(size % FRAME_SIZE == 0); 242 242 243 if (!size) return; 244 243 if (!size) 244 return; 245 245 246 for (i = 0; i < zone_blacklist_count; i++) { 246 247 if (zone_blacklist[i].base >= base && zone_blacklist[i].base < base + size) { … … 304 305 305 306 z->free_count = cnt; 306 list_initialize(&z->free_head);307 308 307 z->busy_count = 0; 309 308 … … 316 315 for (i = 0; i<cnt; i++) { 317 316 frame_initialize(&z->frames[i], z); 318 list_append(&z->frames[i].link, &z->free_head);319 317 } 320 318 … … 322 320 * Create buddy system for the zone 323 321 */ 324 for (max_order = 0; cnt >> max_order; max_order++); 322 for (max_order = 0; cnt >> max_order; max_order++) 323 ; 325 324 z->buddy_system = buddy_system_create(max_order, &zone_buddy_system_operations, (void *) z); 326 325 … … 364 363 frame->refcount = 1; 365 364 frame->buddy_order = 0; 366 link_initialize(&frame->link);367 365 } 368 366
Note:
See TracChangeset
for help on using the changeset viewer.