Ignore:
File:
1 edited

Legend:

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

    rdb675dd rc8cbd39  
    6969#include <str.h>
    7070#include <sysinfo/stats.h>
     71#include <sysinfo/sysinfo.h>
    7172#include <align.h>
    7273
     
    116117                 * Just a beautification.
    117118                 */
    118                 thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true);
     119                thread = thread_create(kmp, NULL, TASK,
     120                    THREAD_FLAG_UNCOUNTED, "kmp");
    119121                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]);
    123123                        thread_ready(thread);
    124124                } else
     
    134134               
    135135                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");
    137138                        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]);
    141140                                thread_ready(thread);
    142141                        } else
     
    152151       
    153152        /* 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");
    155155        if (thread != NULL)
    156156                thread_ready(thread);
     
    163163                 * Create kernel console.
    164164                 */
    165                 thread = thread_create(kconsole_thread, NULL, TASK, 0, "kconsole", false);
     165                thread = thread_create(kconsole_thread, NULL, TASK,
     166                    THREAD_FLAG_NONE, "kconsole");
    166167                if (thread != NULL)
    167168                        thread_ready(thread);
     
    179180        program_t programs[CONFIG_INIT_TASKS];
    180181       
     182        // FIXME: do not propagate arguments through sysinfo
     183        // but pass them directly to the tasks
     184        for (i = 0; i < init.cnt; i++) {
     185                const char *arguments = init.tasks[i].arguments;
     186                if (str_length(arguments) == 0)
     187                        continue;
     188                if (str_length(init.tasks[i].name) == 0)
     189                        continue;
     190                size_t arguments_size = str_size(arguments);
     191
     192                void *arguments_copy = malloc(arguments_size, 0);
     193                if (arguments_copy == NULL)
     194                        continue;
     195                memcpy(arguments_copy, arguments, arguments_size);
     196
     197                char item_name[CONFIG_TASK_NAME_BUFLEN + 15];
     198                snprintf(item_name, CONFIG_TASK_NAME_BUFLEN + 15,
     199                    "init_args.%s", init.tasks[i].name);
     200
     201                sysinfo_set_item_data(item_name, NULL, arguments_copy, arguments_size);
     202        }
     203
    181204        for (i = 0; i < init.cnt; i++) {
    182205                if (init.tasks[i].paddr % FRAME_SIZE) {
Note: See TracChangeset for help on using the changeset viewer.