Changeset a35b458 in mainline for kernel/generic/src/main/main.c
- Timestamp:
- 2018-03-02T20:10:49Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/main.c
r3061bc1 ra35b458 166 166 config.cpu_count = 1; 167 167 config.cpu_active = 1; 168 168 169 169 config.base = hardcoded_load_address; 170 170 config.kernel_size = ALIGN_UP(hardcoded_ktext_size + 171 171 hardcoded_kdata_size, PAGE_SIZE); 172 172 config.stack_size = STACK_SIZE; 173 173 174 174 /* Initialy the stack is placed just after the kernel */ 175 175 config.stack_base = config.base + config.kernel_size; 176 176 177 177 /* Avoid placing stack on top of init */ 178 178 size_t i; … … 190 190 } 191 191 } 192 192 193 193 /* Avoid placing stack on top of boot allocations. */ 194 194 if (ballocs.size) { … … 198 198 ballocs.size, PAGE_SIZE); 199 199 } 200 200 201 201 if (config.stack_base < stack_safe) 202 202 config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE); 203 203 204 204 context_save(&ctx); 205 205 context_set(&ctx, FADDR(main_bsp_separated_stack), … … 218 218 /* Keep this the first thing. */ 219 219 the_initialize(THE); 220 220 221 221 version_print(); 222 222 223 223 LOG("\nconfig.base=%p config.kernel_size=%zu" 224 224 "\nconfig.stack_base=%p config.stack_size=%zu", 225 225 (void *) config.base, config.kernel_size, 226 226 (void *) config.stack_base, config.stack_size); 227 227 228 228 #ifdef CONFIG_KCONSOLE 229 229 /* … … 234 234 kconsole_init(); 235 235 #endif 236 236 237 237 /* 238 238 * Exception handler initialization, before architecture … … 240 240 */ 241 241 exc_init(); 242 242 243 243 /* 244 244 * Memory management subsystems initialization. … … 260 260 ARCH_OP(pre_smp_init); 261 261 smp_init(); 262 262 263 263 /* Slab must be initialized after we know the number of processors. */ 264 264 slab_enable_cpucache(); 265 265 266 266 uint64_t size; 267 267 const char *size_suffix; … … 269 269 printf("Detected %u CPU(s), %" PRIu64 " %s free memory\n", 270 270 config.cpu_count, size, size_suffix); 271 271 272 272 cpu_init(); 273 273 calibrate_delay_loop(); … … 293 293 } else 294 294 printf("No init binaries found.\n"); 295 295 296 296 ipc_init(); 297 297 event_init(); … … 299 299 log_init(); 300 300 stats_init(); 301 301 302 302 /* 303 303 * Create kernel task. … … 306 306 if (!kernel) 307 307 panic("Cannot create kernel task."); 308 308 309 309 /* 310 310 * Create the first thread. … … 315 315 panic("Cannot create kinit thread."); 316 316 thread_ready(kinit_thread); 317 317 318 318 /* 319 319 * This call to scheduler() will return to kinit, … … 344 344 */ 345 345 config.cpu_active++; 346 346 347 347 /* 348 348 * The THE structure is well defined because ctx.sp is used as stack. 349 349 */ 350 350 the_initialize(THE); 351 351 352 352 ARCH_OP(pre_mm_init); 353 353 frame_init(); … … 355 355 tlb_init(); 356 356 ARCH_OP(post_mm_init); 357 357 358 358 cpu_init(); 359 359 calibrate_delay_loop(); 360 360 ARCH_OP(post_cpu_init); 361 361 362 362 the_copy(THE, (the_t *) CPU->stack); 363 363 364 364 /* 365 365 * If we woke kmp up before we left the kernel stack, we could … … 382 382 { 383 383 smp_call_init(); 384 384 385 385 /* 386 386 * Configure timeouts for this cpu. 387 387 */ 388 388 timeout_init(); 389 389 390 390 waitq_wakeup(&ap_completion_wq, WAKEUP_FIRST); 391 391 scheduler();
Note:
See TracChangeset
for help on using the changeset viewer.