Changeset d6e8529 in mainline for generic/src/main/main.c
- Timestamp:
- 2005-12-20T00:34:12Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa7450c
- Parents:
- 75e1db0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.