Changes in kernel/generic/src/main/kinit.c [bdca26a:6a044dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/kinit.c
rbdca26a r6a044dd 61 61 #include <stdio.h> 62 62 #include <log.h> 63 #include <mem .h>63 #include <memw.h> 64 64 #include <console/console.h> 65 65 #include <interrupt.h> … … 69 69 #include <ipc/ipc.h> 70 70 #include <str.h> 71 #include <str_error.h> 71 72 #include <sysinfo/stats.h> 72 73 #include <sysinfo/sysinfo.h> 73 74 #include <align.h> 74 75 #include <stdlib.h> 76 #include <debug/register.h> 75 77 76 78 #ifdef CONFIG_SMP … … 102 104 thread_t *thread; 103 105 104 /*105 * Detach kinit as nobody will call thread_join_timeout() on it.106 */107 thread_detach(THREAD);108 109 106 interrupts_disable(); 110 107 111 108 #ifdef CONFIG_SMP 112 109 if (config.cpu_count > 1) { 113 waitq_initialize(&ap_completion_wq);110 semaphore_initialize(&ap_completion_semaphore, 0); 114 111 115 112 /* … … 125 122 126 123 thread_wire(thread, &cpus[0]); 127 thread_ ready(thread);124 thread_start(thread); 128 125 thread_join(thread); 129 thread_detach(thread);130 126 131 127 /* … … 139 135 if (thread != NULL) { 140 136 thread_wire(thread, &cpus[i]); 141 thread_ready(thread); 137 thread_start(thread); 138 thread_detach(thread); 142 139 } else 143 140 log(LF_OTHER, LVL_ERROR, … … 155 152 thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE, 156 153 "kload"); 157 if (thread != NULL) 158 thread_ready(thread); 159 else 154 if (thread != NULL) { 155 thread_start(thread); 156 thread_detach(thread); 157 } else { 160 158 log(LF_OTHER, LVL_ERROR, "Unable to create kload thread"); 159 } 161 160 162 161 #ifdef CONFIG_KCONSOLE … … 167 166 thread = thread_create(kconsole_thread, NULL, TASK, 168 167 THREAD_FLAG_NONE, "kconsole"); 169 if (thread != NULL) 170 thread_ready(thread); 171 else 168 if (thread != NULL) { 169 thread_start(thread); 170 thread_detach(thread); 171 } else { 172 172 log(LF_OTHER, LVL_ERROR, 173 173 "Unable to create kconsole thread"); 174 } 174 175 } 175 176 #endif /* CONFIG_KCONSOLE */ … … 187 188 */ 188 189 size_t i; 189 program_t programs[CONFIG_INIT_TASKS] ;190 program_t programs[CONFIG_INIT_TASKS] = { }; 190 191 191 192 // FIXME: do not propagate arguments through sysinfo … … 242 243 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 243 244 assert(page); 245 246 if (str_cmp(name, "kernel.dbg") == 0) { 247 /* 248 * Not an actual init task, but rather debug sections extracted 249 * from the kernel ELF file and handed to us here so we can use 250 * it for debugging. 251 */ 252 253 register_debug_data((void *) page, init.tasks[i].size); 254 programs[i].task = NULL; 255 continue; 256 } 244 257 245 258 if (str_cmp(name, "loader") == 0) { … … 259 272 } 260 273 261 errno_t rc = program_create_from_image((void *) page, namebuf,274 errno_t rc = program_create_from_image((void *) page, init.tasks[i].size, namebuf, 262 275 &programs[i]); 263 276 … … 283 296 } 284 297 285 } else if (i == init.cnt - 1) { 286 /* 287 * Assume the last task is the RAM disk. 288 */ 298 } else if (str_cmp(name, "initrd.img") == 0) { 289 299 init_rd((void *) init.tasks[i].paddr, init.tasks[i].size); 290 300 } else { … … 300 310 */ 301 311 for (i = 0; i < init.cnt; i++) { 302 if (programs[i].task != NULL) 312 if (programs[i].task != NULL) { 303 313 program_ready(&programs[i]); 314 task_release(programs[i].task); 315 } 304 316 } 305 317
Note:
See TracChangeset
for help on using the changeset viewer.