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