Changeset 4457455 in mainline
- Timestamp:
- 2005-12-05T17:02:40Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 61e6c39
- Parents:
- 9ebc238
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/mm/frame.c
r9ebc238 r4457455 42 42 { 43 43 zone_t *z; 44 __address start, stop;45 size_t size;46 44 __u8 i; 47 45 … … 54 52 frame_region_not_free(BOOTSTRAP_OFFSET, hardcoded_unmapped_ktext_size + hardcoded_unmapped_kdata_size); 55 53 56 for (i =0;i<e820counter;i++) {57 if (e820table[i].type ==MEMMAP_MEMORY_AVAILABLE) {54 for (i = 0; i < e820counter; i++) { 55 if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) { 58 56 zone_create_in_region(e820table[i].base_address, e820table[i].size & ~(FRAME_SIZE-1)); 59 57 } -
arch/ia64/include/mm/page.h
r9ebc238 r4457455 35 35 #define PAGE_SIZE FRAME_SIZE 36 36 37 #define KA2PA(x) (( (__address) (x))-0x8000000000000000)38 #define PA2KA(x) (( (__address) (x))+0x8000000000000000)37 #define KA2PA(x) ((__address) (x)) 38 #define PA2KA(x) ((__address) (x)) 39 39 40 40 #define page_arch_init() ; -
generic/include/mm/frame.h
r9ebc238 r4457455 55 55 __address base; /**< physical address of the first frame in the frames array */ 56 56 frame_t *frames; /**< array of frame_t structures in this zone */ 57 link_t free_head; /**< list of free frame_t structures */58 57 count_t free_count; /**< number of frame_t structures in free list */ 59 58 count_t busy_count; /**< number of frame_t structures not in free list */ … … 64 63 65 64 struct frame { 66 count_t refcount; /**< when == 0, the frame is in free list */ 67 link_t link; /**< link to zone free list when refcount == 0 */ 65 count_t refcount; /**< tracking of shared frames */ 68 66 __u8 buddy_order; /**< buddy system block order */ 69 link_t buddy_link; /**< link to the next free block inside one order */67 link_t buddy_link; /**< link to the next free block inside one order */ 70 68 }; 71 69 -
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.