Changeset a35b458 in mainline for kernel/generic/src/main/kinit.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 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/kinit.c
r3061bc1 ra35b458 102 102 { 103 103 thread_t *thread; 104 104 105 105 /* 106 106 * Detach kinit as nobody will call thread_join_timeout() on it. … … 109 109 110 110 interrupts_disable(); 111 111 112 112 /* Start processing RCU callbacks. RCU is fully functional afterwards. */ 113 113 rcu_kinit_init(); 114 114 115 115 /* 116 116 * Start processing work queue items. Some may have been queued during boot. 117 117 */ 118 118 workq_global_worker_init(); 119 119 120 120 #ifdef CONFIG_SMP 121 121 if (config.cpu_count > 1) { 122 122 waitq_initialize(&ap_completion_wq); 123 123 124 124 /* 125 125 * Create the kmp thread and wait for its completion. … … 135 135 } else 136 136 panic("Unable to create kmp thread."); 137 137 138 138 thread_join(thread); 139 139 thread_detach(thread); 140 140 141 141 /* 142 142 * For each CPU, create its load balancing thread. 143 143 */ 144 144 unsigned int i; 145 145 146 146 for (i = 0; i < config.cpu_count; i++) { 147 147 thread = thread_create(kcpulb, NULL, TASK, … … 156 156 } 157 157 #endif /* CONFIG_SMP */ 158 158 159 159 /* 160 160 * At this point SMP, if present, is configured. 161 161 */ 162 162 ARCH_OP(post_smp_init); 163 163 164 164 /* Start thread computing system load */ 165 165 thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE, … … 169 169 else 170 170 log(LF_OTHER, LVL_ERROR, "Unable to create kload thread"); 171 171 172 172 #ifdef CONFIG_KCONSOLE 173 173 if (stdin) { … … 184 184 } 185 185 #endif /* CONFIG_KCONSOLE */ 186 186 187 187 /* 188 188 * Store the default stack size in sysinfo so that uspace can create … … 190 190 */ 191 191 sysinfo_set_item_val("default.stack_size", NULL, STACK_SIZE_USER); 192 192 193 193 interrupts_enable(); 194 194 195 195 /* 196 196 * Create user tasks, load RAM disk images. … … 198 198 size_t i; 199 199 program_t programs[CONFIG_INIT_TASKS]; 200 200 201 201 // FIXME: do not propagate arguments through sysinfo 202 202 // but pass them directly to the tasks … … 228 228 continue; 229 229 } 230 230 231 231 /* 232 232 * Construct task name from the 'init:' prefix and the 233 233 * name stored in the init structure (if any). 234 234 */ 235 235 236 236 char namebuf[TASK_NAME_BUFLEN]; 237 237 238 238 const char *name = init.tasks[i].name; 239 239 if (name[0] == 0) 240 240 name = "<unknown>"; 241 241 242 242 static_assert(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN, ""); 243 243 str_cpy(namebuf, TASK_NAME_BUFLEN, INIT_PREFIX); 244 244 str_cpy(namebuf + INIT_PREFIX_LEN, 245 245 TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name); 246 246 247 247 /* 248 248 * Create virtual memory mappings for init task images. … … 252 252 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 253 253 assert(page); 254 254 255 255 errno_t rc = program_create_from_image((void *) page, namebuf, 256 256 &programs[i]); 257 257 258 258 if (rc == 0) { 259 259 if (programs[i].task != NULL) { … … 264 264 PERM_PERM | PERM_MEM_MANAGER | 265 265 PERM_IO_MANAGER | PERM_IRQ_REG); 266 266 267 267 if (!ipc_phone_0) { 268 268 ipc_phone_0 = &programs[i].task->answerbox; … … 276 276 } 277 277 } 278 278 279 279 /* 280 280 * If programs[i].task == NULL then it is … … 293 293 str_error_name(rc), programs[i].loader_status); 294 294 } 295 295 296 296 /* 297 297 * Run user tasks. … … 301 301 program_ready(&programs[i]); 302 302 } 303 303 304 304 #ifdef CONFIG_KCONSOLE 305 305 if (!stdin) { 306 306 thread_sleep(10); 307 307 printf("kinit: No stdin\nKernel alive: ."); 308 308 309 309 unsigned int i = 0; 310 310 while (true) {
Note:
See TracChangeset
for help on using the changeset viewer.