Changes in kernel/generic/src/main/kinit.c [221c9ec:a4e23f8c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/kinit.c
r221c9ec ra4e23f8c 69 69 #include <str.h> 70 70 #include <sysinfo/stats.h> 71 #include <sysinfo/sysinfo.h> 71 72 #include <align.h> 72 73 … … 116 117 * Just a beautification. 117 118 */ 118 thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true); 119 thread = thread_create(kmp, NULL, TASK, 120 THREAD_FLAG_UNCOUNTED, "kmp"); 119 121 if (thread != NULL) { 120 irq_spinlock_lock(&thread->lock, false); 121 thread->cpu = &cpus[0]; 122 irq_spinlock_unlock(&thread->lock, false); 122 thread_wire(thread, &cpus[0]); 123 123 thread_ready(thread); 124 124 } else … … 134 134 135 135 for (i = 0; i < config.cpu_count; i++) { 136 thread = thread_create(kcpulb, NULL, TASK, THREAD_FLAG_WIRED, "kcpulb", true); 136 thread = thread_create(kcpulb, NULL, TASK, 137 THREAD_FLAG_UNCOUNTED, "kcpulb"); 137 138 if (thread != NULL) { 138 irq_spinlock_lock(&thread->lock, false); 139 thread->cpu = &cpus[i]; 140 irq_spinlock_unlock(&thread->lock, false); 139 thread_wire(thread, &cpus[i]); 141 140 thread_ready(thread); 142 141 } else … … 152 151 153 152 /* Start thread computing system load */ 154 thread = thread_create(kload, NULL, TASK, 0, "kload", false); 153 thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE, 154 "kload"); 155 155 if (thread != NULL) 156 156 thread_ready(thread); … … 163 163 * Create kernel console. 164 164 */ 165 thread = thread_create(kconsole_thread, NULL, TASK, 0, "kconsole", false); 165 thread = thread_create(kconsole_thread, NULL, TASK, 166 THREAD_FLAG_NONE, "kconsole"); 166 167 if (thread != NULL) 167 168 thread_ready(thread); … … 171 172 #endif /* CONFIG_KCONSOLE */ 172 173 174 /* 175 * Store the default stack size in sysinfo so that uspace can create 176 * stack with this default size. 177 */ 178 sysinfo_set_item_val("default.stack_size", NULL, STACK_SIZE_USER); 179 173 180 interrupts_enable(); 174 181 … … 179 186 program_t programs[CONFIG_INIT_TASKS]; 180 187 188 // FIXME: do not propagate arguments through sysinfo 189 // but pass them directly to the tasks 190 for (i = 0; i < init.cnt; i++) { 191 const char *arguments = init.tasks[i].arguments; 192 if (str_length(arguments) == 0) 193 continue; 194 if (str_length(init.tasks[i].name) == 0) 195 continue; 196 size_t arguments_size = str_size(arguments); 197 198 void *arguments_copy = malloc(arguments_size, 0); 199 if (arguments_copy == NULL) 200 continue; 201 memcpy(arguments_copy, arguments, arguments_size); 202 203 char item_name[CONFIG_TASK_NAME_BUFLEN + 15]; 204 snprintf(item_name, CONFIG_TASK_NAME_BUFLEN + 15, 205 "init_args.%s", init.tasks[i].name); 206 207 sysinfo_set_item_data(item_name, NULL, arguments_copy, arguments_size); 208 } 209 181 210 for (i = 0; i < init.cnt; i++) { 182 211 if (init.tasks[i].paddr % FRAME_SIZE) { … … 201 230 str_cpy(namebuf + INIT_PREFIX_LEN, 202 231 TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name); 203 232 204 233 /* 205 234 * Create virtual memory mappings for init task images. … … 221 250 CAP_IO_MANAGER | CAP_IRQ_REG); 222 251 223 if (!ipc_phone_0) 252 if (!ipc_phone_0) { 224 253 ipc_phone_0 = &programs[i].task->answerbox; 254 /* 255 * Hold the first task so that the 256 * ipc_phone_0 remains a valid pointer 257 * even if the first task exits for 258 * whatever reason. 259 */ 260 task_hold(programs[i].task); 261 } 225 262 } 226 263 … … 236 273 init_rd((void *) init.tasks[i].paddr, init.tasks[i].size); 237 274 } else 238 printf("init[%zu]: Init binary load failed (error %d)\n", i, rc); 275 printf("init[%zu]: Init binary load failed " 276 "(error %d, loader status %u)\n", i, rc, 277 programs[i].loader_status); 239 278 } 240 279
Note:
See TracChangeset
for help on using the changeset viewer.