Changeset 5d2ab23 in mainline
- Timestamp:
- 2006-01-17T20:52:33Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 64c44e8
- Parents:
- 77147d6
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/mips32/src/mm/frame.c
r77147d6 r5d2ab23 51 51 else 52 52 zone_create_in_region(KA2PA(KERNEL_LOAD_ADDRESS), 53 config.memory_size & ~(FRAME_SIZE-1));53 (config.memory_size & ~(FRAME_SIZE-1))); 54 54 } -
generic/include/mm/frame.h
r77147d6 r5d2ab23 50 50 #define ADDR2FRAME(zone, addr) (&((zone)->frames[((addr) - (zone)->base) / FRAME_SIZE])) 51 51 #define FRAME_INDEX(zone, frame) ((index_t)((frame) - (zone)->frames)) 52 #define FRAME_INDEX_ABS(zone, frame) (((index_t)((frame) - (zone)->frames)) + (zone)->base_index) 52 53 #define FRAME_INDEX_VALID(zone, index) (((index) >= 0) && ((index) < ((zone)->free_count + (zone)->busy_count))) 53 54 #define IS_BUDDY_ORDER_OK(index, order) ((~(((__native) -1) << (order)) & (index)) == 0) 54 55 #define IS_BUDDY_LEFT_BLOCK(zone, frame) (((FRAME_INDEX((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) 55 56 #define IS_BUDDY_RIGHT_BLOCK(zone, frame) (((FRAME_INDEX((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) 57 #define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame) (((FRAME_INDEX_ABS((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) 58 #define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame) (((FRAME_INDEX_ABS((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) 56 59 57 60 #define ZONE_BLACKLIST_SIZE 4 … … 62 65 SPINLOCK_DECLARE(lock); /**< this lock protects everything below */ 63 66 __address base; /**< physical address of the first frame in the frames array */ 67 index_t base_index; /**< frame index offset of the zone base */ 64 68 frame_t *frames; /**< array of frame_t structures in this zone */ 65 69 count_t free_count; /**< number of free frame_t structures */ -
generic/src/main/main.c
r77147d6 r5d2ab23 123 123 124 124 context_save(&ctx); 125 context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + config.kernel_size , CONFIG_STACK_SIZE);125 context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + config.kernel_size - CONFIG_STACK_SIZE, CONFIG_STACK_SIZE); 126 126 context_restore(&ctx); 127 127 /* not reached */ -
generic/src/mm/frame.c
r77147d6 r5d2ab23 134 134 } 135 135 136 137 136 /* Allocate frames from zone buddy system */ 138 137 tmp = buddy_system_alloc(zone->buddy_system, order); … … 161 160 *status = FRAME_OK; 162 161 } 163 164 162 return v; 165 163 } … … 180 178 zone_t *zone = NULL; 181 179 frame_t *frame; 180 int order; 181 182 182 ASSERT(addr % FRAME_SIZE == 0); 183 183 … … 210 210 211 211 frame = ADDR2FRAME(zone, addr); 212 213 /* remember frame order */ 214 order = frame->buddy_order; 212 215 213 216 ASSERT(frame->refcount); … … 218 221 219 222 /* Update zone information. */ 220 zone->free_count += (1 << frame->buddy_order);221 zone->busy_count -= (1 << frame->buddy_order);223 zone->free_count += (1 << order); 224 zone->busy_count -= (1 << order); 222 225 223 226 spinlock_unlock(&zone->lock); … … 322 325 323 326 z->base = start; 327 z->base_index = start / FRAME_SIZE; 328 324 329 z->flags = flags; 325 330 … … 349 354 buddy_system_free(z->buddy_system, &z->frames[i].buddy_link); 350 355 } 356 351 357 } 352 358 return z; … … 401 407 frame = list_get_instance(block, frame_t, buddy_link); 402 408 zone = (zone_t *) b->data; 403 404 ASSERT(IS_BUDDY_ORDER_OK(FRAME_INDEX(zone, frame), frame->buddy_order));405 406 is_left = IS_BUDDY_LEFT_BLOCK (zone, frame);407 is_right = IS_BUDDY_RIGHT_BLOCK (zone, frame);409 ASSERT(IS_BUDDY_ORDER_OK(FRAME_INDEX_ABS(zone, frame), frame->buddy_order)); 410 411 412 is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame); 413 is_right = IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame); 408 414 409 415 ASSERT(is_left ^ is_right); -
test/mm/falloc1/test.c
r77147d6 r5d2ab23 34 34 #include <debug.h> 35 35 36 #define MAX_FRAMES 102436 #define MAX_FRAMES 2048 37 37 #define MAX_ORDER 8 38 38 #define TEST_RUNS 4 … … 53 53 allocated = 0; 54 54 for (i=0;i<MAX_FRAMES>>order;i++) { 55 frames[allocated] = frame_alloc(FRAME_NON_BLOCKING,order, &status); 55 frames[allocated] = frame_alloc(FRAME_NON_BLOCKING, order, &status); 56 57 if (frames[allocated] % (FRAME_SIZE << order) != 0) { 58 panic("Test failed. Block at address %X (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); 59 } 60 56 61 if (status == 0) { 57 62 allocated++;
Note:
See TracChangeset
for help on using the changeset viewer.