Ignore:
File:
1 edited

Legend:

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

    r74cb6610 rbdca26a  
    6161#include <stdio.h>
    6262#include <log.h>
    63 #include <memw.h>
     63#include <mem.h>
    6464#include <console/console.h>
    6565#include <interrupt.h>
     
    6969#include <ipc/ipc.h>
    7070#include <str.h>
    71 #include <str_error.h>
    7271#include <sysinfo/stats.h>
    7372#include <sysinfo/sysinfo.h>
    7473#include <align.h>
    7574#include <stdlib.h>
    76 #include <debug/register.h>
    7775
    7876#ifdef CONFIG_SMP
     
    104102        thread_t *thread;
    105103
     104        /*
     105         * Detach kinit as nobody will call thread_join_timeout() on it.
     106         */
     107        thread_detach(THREAD);
     108
    106109        interrupts_disable();
    107110
    108111#ifdef CONFIG_SMP
    109112        if (config.cpu_count > 1) {
    110                 semaphore_initialize(&ap_completion_semaphore, 0);
     113                waitq_initialize(&ap_completion_wq);
    111114
    112115                /*
     
    122125
    123126                thread_wire(thread, &cpus[0]);
    124                 thread_start(thread);
     127                thread_ready(thread);
    125128                thread_join(thread);
     129                thread_detach(thread);
    126130
    127131                /*
     
    135139                        if (thread != NULL) {
    136140                                thread_wire(thread, &cpus[i]);
    137                                 thread_start(thread);
    138                                 thread_detach(thread);
     141                                thread_ready(thread);
    139142                        } else
    140143                                log(LF_OTHER, LVL_ERROR,
     
    152155        thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE,
    153156            "kload");
    154         if (thread != NULL) {
    155                 thread_start(thread);
    156                 thread_detach(thread);
    157         } else {
     157        if (thread != NULL)
     158                thread_ready(thread);
     159        else
    158160                log(LF_OTHER, LVL_ERROR, "Unable to create kload thread");
    159         }
    160161
    161162#ifdef CONFIG_KCONSOLE
     
    166167                thread = thread_create(kconsole_thread, NULL, TASK,
    167168                    THREAD_FLAG_NONE, "kconsole");
    168                 if (thread != NULL) {
    169                         thread_start(thread);
    170                         thread_detach(thread);
    171                 } else {
     169                if (thread != NULL)
     170                        thread_ready(thread);
     171                else
    172172                        log(LF_OTHER, LVL_ERROR,
    173173                            "Unable to create kconsole thread");
    174                 }
    175174        }
    176175#endif /* CONFIG_KCONSOLE */
     
    188187         */
    189188        size_t i;
    190         program_t programs[CONFIG_INIT_TASKS] = { };
     189        program_t programs[CONFIG_INIT_TASKS];
    191190
    192191        // FIXME: do not propagate arguments through sysinfo
     
    243242                    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
    244243                assert(page);
    245 
    246                 if (str_cmp(name, "kernel.dbg") == 0) {
    247                         /*
    248                          * Not an actual init task, but rather debug sections extracted
    249                          * from the kernel ELF file and handed to us here so we can use
    250                          * it for debugging.
    251                          */
    252 
    253                         register_debug_data((void *) page, init.tasks[i].size);
    254                         programs[i].task = NULL;
    255                         continue;
    256                 }
    257244
    258245                if (str_cmp(name, "loader") == 0) {
     
    272259                }
    273260
    274                 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,
    275262                    &programs[i]);
    276263
     
    313300         */
    314301        for (i = 0; i < init.cnt; i++) {
    315                 if (programs[i].task != NULL) {
     302                if (programs[i].task != NULL)
    316303                        program_ready(&programs[i]);
    317                         task_release(programs[i].task);
    318                 }
    319304        }
    320305
Note: See TracChangeset for help on using the changeset viewer.