Changeset f8ddd17 in mainline for kernel/generic/src/main/main.c
- Timestamp:
- 2006-12-09T20:20:50Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b82a13c
- Parents:
- 9ab9c2ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/main.c
r9ab9c2ec rf8ddd17 81 81 #include <console/klog.h> 82 82 #include <smp/smp.h> 83 #include <ddi/ddi.h> 83 84 84 85 /** Global configuration structure. */ … … 103 104 * appropriate sizes and addresses. 104 105 */ 105 uintptr_t hardcoded_load_address = 0; /**< Virtual address of where the kernel is loaded. */ 106 size_t hardcoded_ktext_size = 0; /**< Size of the kernel code in bytes. */ 107 size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */ 108 109 uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */ 106 uintptr_t hardcoded_load_address = 0; /**< Virtual address of where the kernel 107 * is loaded. */ 108 size_t hardcoded_ktext_size = 0; /**< Size of the kernel code in bytes. 109 */ 110 size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. 111 */ 112 uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address. 113 */ 110 114 111 115 void main_bsp(void); … … 142 146 config.memory_size = get_memory_size(); 143 147 144 config.kernel_size = ALIGN_UP(hardcoded_ktext_size + hardcoded_kdata_size, PAGE_SIZE); 148 config.kernel_size = ALIGN_UP(hardcoded_ktext_size + 149 hardcoded_kdata_size, PAGE_SIZE); 145 150 config.stack_size = CONFIG_STACK_SIZE; 146 151 … … 151 156 count_t i; 152 157 for (i = 0; i < init.cnt; i++) { 153 if (PA_overlaps(config.stack_base, config.stack_size, init.tasks[i].addr, init.tasks[i].size)) 154 config.stack_base = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, config.stack_size); 158 if (PA_overlaps(config.stack_base, config.stack_size, 159 init.tasks[i].addr, init.tasks[i].size)) 160 config.stack_base = ALIGN_UP(init.tasks[i].addr + 161 init.tasks[i].size, config.stack_size); 155 162 } 156 163 157 164 /* Avoid placing stack on top of boot allocations. */ 158 165 if (ballocs.size) { 159 if (PA_overlaps(config.stack_base, config.stack_size, ballocs.base, ballocs.size)) 160 config.stack_base = ALIGN_UP(ballocs.base + ballocs.size, PAGE_SIZE); 166 if (PA_overlaps(config.stack_base, config.stack_size, 167 ballocs.base, ballocs.size)) 168 config.stack_base = ALIGN_UP(ballocs.base + 169 ballocs.size, PAGE_SIZE); 161 170 } 162 171 … … 165 174 166 175 context_save(&ctx); 167 context_set(&ctx, FADDR(main_bsp_separated_stack), config.stack_base, THREAD_STACK_SIZE); 176 context_set(&ctx, FADDR(main_bsp_separated_stack), config.stack_base, 177 THREAD_STACK_SIZE); 168 178 context_restore(&ctx); 169 179 /* not reached */ … … 201 211 */ 202 212 arch_pre_mm_init(); 203 frame_init(); /* Initialize at least 1 memory segment big enough for slab to work */ 213 frame_init(); 214 /* Initialize at least 1 memory segment big enough for slab to work. */ 204 215 slab_cache_init(); 205 216 btree_init(); … … 207 218 page_init(); 208 219 tlb_init(); 220 ddi_init(); 209 221 arch_post_mm_init(); 210 222 211 223 version_print(); 212 printf("kernel: %.*p hardcoded_ktext_size=%zdK, hardcoded_kdata_size=%zdK\n", sizeof(uintptr_t) * 2, config.base, hardcoded_ktext_size >> 10, hardcoded_kdata_size >> 10); 213 printf("stack: %.*p size=%zdK\n", sizeof(uintptr_t) * 2, config.stack_base, config.stack_size >> 10); 224 printf("kernel: %.*p hardcoded_ktext_size=%zdK, " 225 "hardcoded_kdata_size=%zdK\n", sizeof(uintptr_t) * 2, 226 config.base, hardcoded_ktext_size >> 10, hardcoded_kdata_size >> 227 10); 228 printf("stack: %.*p size=%zdK\n", sizeof(uintptr_t) * 2, 229 config.stack_base, config.stack_size >> 10); 214 230 215 231 arch_pre_smp_init(); 216 232 smp_init(); 217 218 slab_enable_cpucache(); /* Slab must be initialized AFTER we know the number of processors */233 /* Slab must be initialized after we know the number of processors. */ 234 slab_enable_cpucache(); 219 235 220 236 printf("config.memory_size=%zdM\n", config.memory_size >> 20); … … 233 249 if (init.cnt > 0) { 234 250 for (i = 0; i < init.cnt; i++) 235 printf("init[%zd].addr=%.*p, init[%zd].size=%zd\n", i, sizeof(uintptr_t) * 2, init.tasks[i].addr, i, init.tasks[i].size); 251 printf("init[%zd].addr=%.*p, init[%zd].size=%zd\n", i, 252 sizeof(uintptr_t) * 2, init.tasks[i].addr, i, 253 init.tasks[i].size); 236 254 } else 237 255 printf("No init binaries found\n"); … … 305 323 * switch to this cpu's private stack prior to waking kmp up. 306 324 */ 307 context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), (uintptr_t) CPU->stack, CPU_STACK_SIZE); 325 context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), 326 (uintptr_t) CPU->stack, CPU_STACK_SIZE); 308 327 context_restore(&CPU->saved_context); 309 328 /* not reached */
Note:
See TracChangeset
for help on using the changeset viewer.