Changes in kernel/generic/src/main/kinit.c [a78b0a0:bdca26a] in mainline
- File:
-
- 1 edited
-
kernel/generic/src/main/kinit.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/kinit.c
ra78b0a0 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) { 113 waitq_initialize(&ap_completion_wq); 114 110 115 /* 111 116 * Create the kmp thread and wait for its completion. … … 120 125 121 126 thread_wire(thread, &cpus[0]); 122 thread_ start(thread);127 thread_ready(thread); 123 128 thread_join(thread); 129 thread_detach(thread); 124 130 125 131 /* … … 133 139 if (thread != NULL) { 134 140 thread_wire(thread, &cpus[i]); 135 thread_start(thread); 136 thread_detach(thread); 141 thread_ready(thread); 137 142 } else 138 143 log(LF_OTHER, LVL_ERROR, … … 150 155 thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE, 151 156 "kload"); 152 if (thread != NULL) { 153 thread_start(thread); 154 thread_detach(thread); 155 } else { 157 if (thread != NULL) 158 thread_ready(thread); 159 else 156 160 log(LF_OTHER, LVL_ERROR, "Unable to create kload thread"); 157 }158 161 159 162 #ifdef CONFIG_KCONSOLE … … 164 167 thread = thread_create(kconsole_thread, NULL, TASK, 165 168 THREAD_FLAG_NONE, "kconsole"); 166 if (thread != NULL) { 167 thread_start(thread); 168 thread_detach(thread); 169 } else { 169 if (thread != NULL) 170 thread_ready(thread); 171 else 170 172 log(LF_OTHER, LVL_ERROR, 171 173 "Unable to create kconsole thread"); 172 }173 174 } 174 175 #endif /* CONFIG_KCONSOLE */ … … 186 187 */ 187 188 size_t i; 188 program_t programs[CONFIG_INIT_TASKS] = { };189 program_t programs[CONFIG_INIT_TASKS]; 189 190 190 191 // FIXME: do not propagate arguments through sysinfo … … 241 242 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE); 242 243 assert(page); 243 244 if (str_cmp(name, "kernel.dbg") == 0) {245 /*246 * Not an actual init task, but rather debug sections extracted247 * from the kernel ELF file and handed to us here so we can use248 * it for debugging.249 */250 251 register_debug_data((void *) page, init.tasks[i].size);252 programs[i].task = NULL;253 continue;254 }255 244 256 245 if (str_cmp(name, "loader") == 0) { … … 270 259 } 271 260 272 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, 273 262 &programs[i]); 274 263 … … 294 283 } 295 284 296 } 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 */ 297 289 init_rd((void *) init.tasks[i].paddr, init.tasks[i].size); 298 290 } else { … … 308 300 */ 309 301 for (i = 0; i < init.cnt; i++) { 310 if (programs[i].task != NULL) {302 if (programs[i].task != NULL) 311 303 program_ready(&programs[i]); 312 task_release(programs[i].task);313 }314 304 } 315 305
Note:
See TracChangeset
for help on using the changeset viewer.
