Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/kinit.c

    ra4e23f8c r221c9ec  
    6969#include <str.h>
    7070#include <sysinfo/stats.h>
    71 #include <sysinfo/sysinfo.h>
    7271#include <align.h>
    7372
     
    117116                 * Just a beautification.
    118117                 */
    119                 thread = thread_create(kmp, NULL, TASK,
    120                     THREAD_FLAG_UNCOUNTED, "kmp");
     118                thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true);
    121119                if (thread != NULL) {
    122                         thread_wire(thread, &cpus[0]);
     120                        irq_spinlock_lock(&thread->lock, false);
     121                        thread->cpu = &cpus[0];
     122                        irq_spinlock_unlock(&thread->lock, false);
    123123                        thread_ready(thread);
    124124                } else
     
    134134               
    135135                for (i = 0; i < config.cpu_count; i++) {
    136                         thread = thread_create(kcpulb, NULL, TASK,
    137                             THREAD_FLAG_UNCOUNTED, "kcpulb");
     136                        thread = thread_create(kcpulb, NULL, TASK, THREAD_FLAG_WIRED, "kcpulb", true);
    138137                        if (thread != NULL) {
    139                                 thread_wire(thread, &cpus[i]);
     138                                irq_spinlock_lock(&thread->lock, false);
     139                                thread->cpu = &cpus[i];
     140                                irq_spinlock_unlock(&thread->lock, false);
    140141                                thread_ready(thread);
    141142                        } else
     
    151152       
    152153        /* Start thread computing system load */
    153         thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE,
    154             "kload");
     154        thread = thread_create(kload, NULL, TASK, 0, "kload", false);
    155155        if (thread != NULL)
    156156                thread_ready(thread);
     
    163163                 * Create kernel console.
    164164                 */
    165                 thread = thread_create(kconsole_thread, NULL, TASK,
    166                     THREAD_FLAG_NONE, "kconsole");
     165                thread = thread_create(kconsole_thread, NULL, TASK, 0, "kconsole", false);
    167166                if (thread != NULL)
    168167                        thread_ready(thread);
     
    172171#endif /* CONFIG_KCONSOLE */
    173172       
    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        
    180173        interrupts_enable();
    181174       
     
    186179        program_t programs[CONFIG_INIT_TASKS];
    187180       
    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 
    210181        for (i = 0; i < init.cnt; i++) {
    211182                if (init.tasks[i].paddr % FRAME_SIZE) {
     
    230201                str_cpy(namebuf + INIT_PREFIX_LEN,
    231202                    TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name);
    232                
     203
    233204                /*
    234205                 * Create virtual memory mappings for init task images.
     
    250221                                    CAP_IO_MANAGER | CAP_IRQ_REG);
    251222                               
    252                                 if (!ipc_phone_0) {
     223                                if (!ipc_phone_0)
    253224                                        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                                 }
    262225                        }
    263226                       
     
    273236                        init_rd((void *) init.tasks[i].paddr, init.tasks[i].size);
    274237                } else
    275                         printf("init[%zu]: Init binary load failed "
    276                             "(error %d, loader status %u)\n", i, rc,
    277                             programs[i].loader_status);
     238                        printf("init[%zu]: Init binary load failed (error %d)\n", i, rc);
    278239        }
    279240       
Note: See TracChangeset for help on using the changeset viewer.