- Timestamp:
- 2006-02-08T22:29:20Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 85dc2e7
- Parents:
- 89298e3
- Location:
- generic
- Files:
-
- 5 edited
-
include/config.h (modified) (2 diffs)
-
include/mm/frame.h (modified) (2 diffs)
-
include/typedefs.h (modified) (1 diff)
-
src/main/kinit.c (modified) (2 diffs)
-
src/mm/frame.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
generic/include/config.h
r89298e3 r42744880 37 37 38 38 #define CONFIG_MEMORY_SIZE (8*1024*1024) 39 #define CONFIG_HEAP_SIZE (300*1024)40 39 #define CONFIG_STACK_SIZE STACK_SIZE 41 40 … … 50 49 size_t init_size; 51 50 52 __address heap_addr; 53 size_t heap_size; 54 size_t heap_delta; /**< Extra space between heap and stack (enforced by alignment requirements) */ 55 56 size_t kernel_size; /**< Size of memory in bytes taken by kernel, heap and stack */ 51 size_t kernel_size; /**< Size of memory in bytes taken by kernel and stack */ 57 52 }; 58 53 -
generic/include/mm/frame.h
r89298e3 r42744880 75 75 } 76 76 77 static inline pfn_t SIZE2PFN(__addresssize)77 static inline count_t SIZE2FRAMES(size_t size) 78 78 { 79 79 if (!size) 80 80 return 0; 81 return ( pfn_t)((size-1) >> FRAME_WIDTH)+1;81 return (count_t)((size-1) >> FRAME_WIDTH)+1; 82 82 } 83 83 … … 96 96 extern void frame_free(__address addr); 97 97 98 extern void zone_create(pfn_t start, pfn_t count, pfn_t confframe, int flags);98 extern void zone_create(pfn_t start, count_t count, pfn_t confframe, int flags); 99 99 100 100 void * frame_get_parent(pfn_t frame, int hint); 101 101 void frame_set_parent(pfn_t frame, void *data, int hint); 102 void frame_mark_unavailable(pfn_t start, pfn_t count);103 __address zone_conf_size(pfn_t start, pfn_t count);102 void frame_mark_unavailable(pfn_t start, count_t count); 103 __address zone_conf_size(pfn_t start, count_t count); 104 104 105 105 /* -
generic/include/typedefs.h
r89298e3 r42744880 35 35 typedef short bool; 36 36 37 typedef unsigned intsize_t;38 typedef unsigned intcount_t;39 typedef unsigned intindex_t;37 typedef unsigned long size_t; 38 typedef unsigned long count_t; 39 typedef unsigned long index_t; 40 40 41 41 typedef struct config config_t; -
generic/src/main/kinit.c
r89298e3 r42744880 73 73 as_area_t *a; 74 74 __address frame; 75 pfn_t frames;75 count_t frames; 76 76 int i; 77 77 task_t *u; … … 166 166 frame = KA2PA(frame); 167 167 168 frames = SIZE2 PFN(config.init_size);168 frames = SIZE2FRAMES(config.init_size); 169 169 170 170 a = as_area_create(as, AS_AREA_TEXT, frames, UTEXT_ADDRESS); -
generic/src/mm/frame.c
r89298e3 r42744880 62 62 SPINLOCK_DECLARE(lock); /**< this lock protects everything below */ 63 63 pfn_t base; /**< frame_no of the first frame in the frames array */ 64 pfn_t count; /**< Size of zone */64 count_t count; /**< Size of zone */ 65 65 66 66 frame_t *frames; /**< array of frame_t structures in this zone */ … … 100 100 101 101 /** Compute pfn_t from frame_t pointer & zone pointer */ 102 static pfn_t make_frame_index(zone_t *zone, frame_t *frame)102 static index_t make_frame_index(zone_t *zone, frame_t *frame) 103 103 { 104 104 return frame - zone->frames; … … 424 424 * Assume zone is locked 425 425 */ 426 static void zone_frame_free(zone_t *zone, pfn_t frame_idx)426 static void zone_frame_free(zone_t *zone, index_t frame_idx) 427 427 { 428 428 frame_t *frame; … … 446 446 447 447 /** Return frame from zone */ 448 static frame_t * zone_get_frame(zone_t *zone, pfn_t frame_idx)448 static frame_t * zone_get_frame(zone_t *zone, index_t frame_idx) 449 449 { 450 450 ASSERT(frame_idx < zone->count); … … 453 453 454 454 /** Mark frame in zone unavailable to allocation */ 455 static void zone_mark_unavailable(zone_t *zone, pfn_t frame_idx)455 static void zone_mark_unavailable(zone_t *zone, index_t frame_idx) 456 456 { 457 457 frame_t *frame; … … 476 476 * @return Initialized zone. 477 477 */ 478 static zone_t * zone_construct(pfn_t start, pfn_t count,478 static zone_t * zone_construct(pfn_t start, count_t count, 479 479 zone_t *z, int flags) 480 480 { … … 517 517 518 518 /** Compute configuration data size for zone */ 519 __address zone_conf_size(pfn_t start, pfn_t count)519 __address zone_conf_size(pfn_t start, count_t count) 520 520 { 521 521 int size = sizeof(zone_t) + count*sizeof(frame_t); … … 531 531 * 532 532 * @param confframe Where configuration frame is supposed to be. 533 * Always check, that we will not disturb kernel pages 534 * the kernel and possibly init. 533 * Always check, that we will not disturb the kernel and possibly init. 535 534 * If confframe is given _outside_ this zone, it is expected, 536 535 * that the area is already marked BUSY and big enough 537 536 * to contain zone_conf_size() amount of data 538 537 */ 539 void zone_create(pfn_t start, pfn_t count, pfn_t confframe, int flags)538 void zone_create(pfn_t start, count_t count, pfn_t confframe, int flags) 540 539 { 541 540 zone_t *z; 542 541 __address addr,endaddr; 543 pfn_t confcount;542 count_t confcount; 544 543 int i; 545 544 … … 552 551 * it does not span kernel & init 553 552 */ 554 confcount = SIZE2 PFN(zone_conf_size(start,count));553 confcount = SIZE2FRAMES(zone_conf_size(start,count)); 555 554 if (confframe >= start && confframe < start+count) { 556 555 for (;confframe < start+count;confframe++) { … … 700 699 701 700 /** Mark given range unavailable in frame zones */ 702 void frame_mark_unavailable(pfn_t start, pfn_t count)701 void frame_mark_unavailable(pfn_t start, count_t count) 703 702 { 704 703 int i; … … 730 729 if (config.cpu_active == 1) { 731 730 frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)), 732 SIZE2 PFN(config.kernel_size));731 SIZE2FRAMES(config.kernel_size)); 733 732 if (config.init_size > 0) 734 733 frame_mark_unavailable(ADDR2PFN(KA2PA(config.init_addr)), 735 SIZE2 PFN(config.init_size));734 SIZE2FRAMES(config.init_size)); 736 735 } 737 736 }
Note:
See TracChangeset
for help on using the changeset viewer.
