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