- Timestamp:
- 2005-12-20T00:34:12Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa7450c
- Parents:
- 75e1db0
- Location:
- generic
- Files:
-
- 3 edited
-
include/arch.h (modified) (1 diff)
-
include/config.h (modified) (1 diff)
-
src/main/main.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
generic/include/arch.h
r75e1db0 rd6e8529 43 43 #define PREEMPTION_DISABLED THE->preemption_disabled 44 44 45 #ifndef early_mapping46 #define early_mapping(stack, size)47 #endif /* early_mapping */48 49 45 /** 50 46 * For each possible kernel stack, structure -
generic/include/config.h
r75e1db0 rd6e8529 41 41 42 42 struct config { 43 count_t cpu_count; 44 volatile count_t cpu_active; 45 43 46 __address base; 44 47 size_t memory_size; 45 size_t kernel_size;46 48 47 49 __address init_addr; 48 50 size_t init_size; 49 50 count_t cpu_count; 51 volatile count_t cpu_active; 51 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 */ 52 57 }; 53 58 -
generic/src/main/main.c
r75e1db0 rd6e8529 83 83 #endif 84 84 85 86 85 config_t config; 87 86 context_t ctx; … … 98 97 __address init_addr = 0; 99 98 size_t init_size = 0; 100 101 /**102 * Size of memory in bytes taken by kernel and heap.103 */104 static size_t kernel_size;105 106 /**107 * Size of heap.108 */109 static size_t heap_size;110 111 112 /**113 * Extra space between heap and stack114 * enforced by alignment requirements.115 */116 static size_t heap_delta;117 99 118 100 void main_bsp(void); … … 141 123 config.cpu_count = 1; 142 124 config.cpu_active = 1; 125 143 126 config.base = hardcoded_load_address; 144 127 config.memory_size = get_memory_size(); 145 128 config.init_addr = init_addr; 146 129 config.init_size = init_size; 147 148 heap_size = CONFIG_HEAP_SIZE + (config.memory_size/FRAME_SIZE)*sizeof(frame_t); 149 kernel_size = ALIGN_UP(hardcoded_ktext_size + hardcoded_kdata_size + heap_size, PAGE_SIZE); 150 heap_delta = kernel_size - (hardcoded_ktext_size + hardcoded_kdata_size + heap_size); 151 152 config.kernel_size = kernel_size + CONFIG_STACK_SIZE; 130 131 if (init_size > 0) 132 config.heap_addr = init_addr + init_size; 133 else 134 config.heap_addr = hardcoded_load_address + hardcoded_ktext_size + hardcoded_kdata_size; 135 136 config.heap_size = CONFIG_HEAP_SIZE + (config.memory_size / FRAME_SIZE) * sizeof(frame_t); 137 138 config.kernel_size = ALIGN_UP(config.heap_addr - hardcoded_load_address + config.heap_size, PAGE_SIZE); 139 config.heap_delta = config.kernel_size - (config.heap_addr - hardcoded_load_address + config.heap_size); 140 config.kernel_size = config.kernel_size + CONFIG_STACK_SIZE; 153 141 154 142 context_save(&ctx); 155 early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_STACK_SIZE + heap_size + heap_delta); 156 context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE); 143 context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + config.kernel_size, CONFIG_STACK_SIZE); 157 144 context_restore(&ctx); 158 145 /* not reached */ … … 186 173 187 174 arch_pre_mm_init(); 188 early_heap_init(config. base + hardcoded_ktext_size + hardcoded_kdata_size, heap_size +heap_delta);175 early_heap_init(config.heap_addr, config.heap_size + config.heap_delta); 189 176 frame_init(); 190 177 page_init(); 191 178 tlb_init(); 192 179 arch_post_mm_init(); 193 180 194 181 printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", project, release, name, revision, timestamp, arch, copyright); 195 182 printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
Note:
See TracChangeset
for help on using the changeset viewer.
