Changeset b87f418 in mainline
- Timestamp:
- 2005-12-07T23:00:30Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f62355a
- Parents:
- 4acac843
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/mm/frame.c
r4acac843 rb87f418 58 58 if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) { 59 59 zone_create_in_region(e820table[i].base_address, e820table[i].size & ~(FRAME_SIZE-1)); 60 if (last_frame < ALIGN (e820table[i].base_address + e820table[i].size, FRAME_SIZE))61 last_frame = ALIGN (e820table[i].base_address + e820table[i].size, FRAME_SIZE);60 if (last_frame < ALIGN_UP(e820table[i].base_address + e820table[i].size, FRAME_SIZE)) 61 last_frame = ALIGN_UP(e820table[i].base_address + e820table[i].size, FRAME_SIZE); 62 62 } 63 63 } -
arch/ia64/include/context.h
r4acac843 rb87f418 41 41 * One item is put onto the stack to support get_stack_base(). 42 42 */ 43 #define SP_DELTA (0+ALIGN (STACK_ITEM_SIZE, STACK_ALIGNMENT))43 #define SP_DELTA (0+ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 44 44 45 45 #define PFM_MASK (~0x3fffffffff) … … 51 51 #define context_set(c, _pc, stack, size) \ 52 52 (c)->pc = (__address) _pc; \ 53 (c)->bsp = ((__address) stack) + ALIGN (sizeof(the_t), REGISTER_STACK_ALIGNMENT); \53 (c)->bsp = ((__address) stack) + ALIGN_UP(sizeof(the_t), REGISTER_STACK_ALIGNMENT); \ 54 54 (c)->ar_pfs &= PFM_MASK; \ 55 (c)->sp = ((__address) stack) + ALIGN ((size), STACK_ALIGNMENT) - SP_DELTA;55 (c)->sp = ((__address) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - SP_DELTA; 56 56 57 57 /* -
arch/sparc64/include/context.h
r4acac843 rb87f418 31 31 32 32 #ifndef __sparc64_STACK_H__ 33 # include <arch/stack.h>33 # include <arch/stack.h> 34 34 #endif 35 35 … … 50 50 #define context_set(c, _pc, stack, size) \ 51 51 (c)->pc = ((__address) _pc) - 8; \ 52 (c)->sp = ((__address) stack) + ALIGN ((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \52 (c)->sp = ((__address) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ 53 53 (c)->fp = -STACK_BIAS 54 54 -
generic/include/align.h
r4acac843 rb87f418 30 30 #define __ALIGN_H__ 31 31 32 #define ALIGN(s, a) ((s) % (a) ? (((s) / (a)) + 1) * (a) : (s)) 32 /** Align to the nearest higher address. 33 * 34 * @param s Address or size to be aligned. 35 * @param a Size of alignment. 36 */ 37 #define ALIGN_UP(s, a) ((s) % (a) ? (((s) / (a)) + 1) * (a) : (s)) 38 39 /** Align to the nearest lower address. 40 * 41 * @param s Address or size to be aligned. 42 * @param a Size of alignment. 43 */ 44 #define ALIGN_DOWN(s, a) ((s) & ~((a)-1)) 33 45 34 46 #endif -
generic/include/mm/frame.h
r4acac843 rb87f418 46 46 #define FRAME_INDEX(zone, frame) ((index_t)((frame) - (zone)->frames)) 47 47 #define FRAME_INDEX_VALID(zone, index) (((index) >= 0) && ((index) < ((zone)->free_count + (zone)->busy_count))) 48 #define IS_BUDDY_LEFT_BLOCK(zone, frame) ((FRAME_INDEX((zone), (frame)) & ~(((__native) -1)<<((frame)->buddy_order + 1))) == 0) 48 #define IS_BUDDY_ORDER_OK(index, order) ((~(((__native) -1) << (order)) & (index)) == 0) 49 #define IS_BUDDY_LEFT_BLOCK(zone, frame) (((FRAME_INDEX((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) 50 #define IS_BUDDY_RIGHT_BLOCK(zone, frame) (((FRAME_INDEX((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) 49 51 50 52 #define ZONE_BLACKLIST_SIZE 3 -
generic/src/main/main.c
r4acac843 rb87f418 142 142 143 143 heap_size = CONFIG_HEAP_SIZE + (config.memory_size/FRAME_SIZE)*sizeof(frame_t); 144 kernel_size = ALIGN (hardcoded_ktext_size + hardcoded_kdata_size + heap_size, PAGE_SIZE);144 kernel_size = ALIGN_UP(hardcoded_ktext_size + hardcoded_kdata_size + heap_size, PAGE_SIZE); 145 145 heap_delta = kernel_size - (hardcoded_ktext_size + hardcoded_kdata_size + heap_size); 146 146 -
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.