Ignore:
File:
1 edited

Legend:

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

    r98000fb r7e752b2  
    6666#include <ipc/ipc.h>
    6767#include <debug.h>
    68 #include <string.h>
     68#include <str.h>
     69#include <sysinfo/stats.h>
    6970
    7071#ifdef CONFIG_SMP
     
    9495void kinit(void *arg)
    9596{
    96 
    97 #if defined(CONFIG_SMP) || defined(CONFIG_KCONSOLE)
    9897        thread_t *thread;
    99 #endif
    10098       
    10199        /*
     
    109107        if (config.cpu_count > 1) {
    110108                waitq_initialize(&ap_completion_wq);
     109               
    111110                /*
    112111                 * Create the kmp thread and wait for its completion.
     
    117116                thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true);
    118117                if (thread != NULL) {
    119                         spinlock_lock(&thread->lock);
     118                        irq_spinlock_lock(&thread->lock, false);
    120119                        thread->cpu = &cpus[0];
    121                         spinlock_unlock(&thread->lock);
     120                        irq_spinlock_unlock(&thread->lock, false);
    122121                        thread_ready(thread);
    123122                } else
    124123                        panic("Unable to create kmp thread.");
     124               
    125125                thread_join(thread);
    126126                thread_detach(thread);
    127         }
    128        
    129         if (config.cpu_count > 1) {
    130                 size_t i;
    131127               
    132128                /*
    133129                 * For each CPU, create its load balancing thread.
    134130                 */
     131                unsigned int i;
     132               
    135133                for (i = 0; i < config.cpu_count; i++) {
    136134                        thread = thread_create(kcpulb, NULL, TASK, THREAD_FLAG_WIRED, "kcpulb", true);
    137135                        if (thread != NULL) {
    138                                 spinlock_lock(&thread->lock);
     136                                irq_spinlock_lock(&thread->lock, false);
    139137                                thread->cpu = &cpus[i];
    140                                 spinlock_unlock(&thread->lock);
     138                                irq_spinlock_unlock(&thread->lock, false);
    141139                                thread_ready(thread);
    142140                        } else
    143                                 printf("Unable to create kcpulb thread for cpu" PRIs "\n", i);
     141                                printf("Unable to create kcpulb thread for cpu%u\n", i);
    144142                }
    145143        }
     
    150148         */
    151149        arch_post_smp_init();
     150       
     151        /* Start thread computing system load */
     152        thread = thread_create(kload, NULL, TASK, 0, "kload", false);
     153        if (thread != NULL)
     154                thread_ready(thread);
     155        else
     156                printf("Unable to create kload thread\n");
    152157       
    153158#ifdef CONFIG_KCONSOLE
     
    174179        for (i = 0; i < init.cnt; i++) {
    175180                if (init.tasks[i].addr % FRAME_SIZE) {
    176                         printf("init[%" PRIs "].addr is not frame aligned\n", i);
     181                        printf("init[%zu].addr is not frame aligned\n", i);
     182                        programs[i].task = NULL;
    177183                        continue;
    178184                }
     
    184190               
    185191                char namebuf[TASK_NAME_BUFLEN];
    186                 char *name;
    187                
    188                 name = init.tasks[i].name;
     192               
     193                const char *name = init.tasks[i].name;
    189194                if (name[0] == 0)
    190195                        name = "<unknown>";
     
    194199                str_cpy(namebuf + INIT_PREFIX_LEN,
    195200                    TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name);
    196 
     201               
    197202                int rc = program_create_from_image((void *) init.tasks[i].addr,
    198203                    namebuf, &programs[i]);
     
    203208                         */
    204209                        cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
    205                             CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG);
     210                            CAP_IO_MANAGER | CAP_IRQ_REG);
    206211                       
    207212                        if (!ipc_phone_0)
     
    214219                       
    215220                        if (rd != RE_OK)
    216                                 printf("Init binary %" PRIs " not used (error %d)\n", i, rd);
     221                                printf("Init binary %zu not used (error %d)\n", i, rd);
    217222                }
    218223        }
Note: See TracChangeset for help on using the changeset viewer.