Ignore:
File:
1 edited

Legend:

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

    r7e752b2 r98000fb  
    6666#include <ipc/ipc.h>
    6767#include <debug.h>
    68 #include <str.h>
    69 #include <sysinfo/stats.h>
     68#include <string.h>
    7069
    7170#ifdef CONFIG_SMP
     
    9594void kinit(void *arg)
    9695{
     96
     97#if defined(CONFIG_SMP) || defined(CONFIG_KCONSOLE)
    9798        thread_t *thread;
     99#endif
    98100       
    99101        /*
     
    107109        if (config.cpu_count > 1) {
    108110                waitq_initialize(&ap_completion_wq);
    109                
    110111                /*
    111112                 * Create the kmp thread and wait for its completion.
     
    116117                thread = thread_create(kmp, NULL, TASK, THREAD_FLAG_WIRED, "kmp", true);
    117118                if (thread != NULL) {
    118                         irq_spinlock_lock(&thread->lock, false);
     119                        spinlock_lock(&thread->lock);
    119120                        thread->cpu = &cpus[0];
    120                         irq_spinlock_unlock(&thread->lock, false);
     121                        spinlock_unlock(&thread->lock);
    121122                        thread_ready(thread);
    122123                } else
    123124                        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;
    127131               
    128132                /*
    129133                 * For each CPU, create its load balancing thread.
    130134                 */
    131                 unsigned int i;
    132                
    133135                for (i = 0; i < config.cpu_count; i++) {
    134136                        thread = thread_create(kcpulb, NULL, TASK, THREAD_FLAG_WIRED, "kcpulb", true);
    135137                        if (thread != NULL) {
    136                                 irq_spinlock_lock(&thread->lock, false);
     138                                spinlock_lock(&thread->lock);
    137139                                thread->cpu = &cpus[i];
    138                                 irq_spinlock_unlock(&thread->lock, false);
     140                                spinlock_unlock(&thread->lock);
    139141                                thread_ready(thread);
    140142                        } else
    141                                 printf("Unable to create kcpulb thread for cpu%u\n", i);
     143                                printf("Unable to create kcpulb thread for cpu" PRIs "\n", i);
    142144                }
    143145        }
     
    148150         */
    149151        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");
    157152       
    158153#ifdef CONFIG_KCONSOLE
     
    179174        for (i = 0; i < init.cnt; i++) {
    180175                if (init.tasks[i].addr % FRAME_SIZE) {
    181                         printf("init[%zu].addr is not frame aligned\n", i);
    182                         programs[i].task = NULL;
     176                        printf("init[%" PRIs "].addr is not frame aligned\n", i);
    183177                        continue;
    184178                }
     
    190184               
    191185                char namebuf[TASK_NAME_BUFLEN];
    192                
    193                 const char *name = init.tasks[i].name;
     186                char *name;
     187               
     188                name = init.tasks[i].name;
    194189                if (name[0] == 0)
    195190                        name = "<unknown>";
     
    199194                str_cpy(namebuf + INIT_PREFIX_LEN,
    200195                    TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name);
    201                
     196
    202197                int rc = program_create_from_image((void *) init.tasks[i].addr,
    203198                    namebuf, &programs[i]);
     
    208203                         */
    209204                        cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
    210                             CAP_IO_MANAGER | CAP_IRQ_REG);
     205                            CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG);
    211206                       
    212207                        if (!ipc_phone_0)
     
    219214                       
    220215                        if (rd != RE_OK)
    221                                 printf("Init binary %zu not used (error %d)\n", i, rd);
     216                                printf("Init binary %" PRIs " not used (error %d)\n", i, rd);
    222217                }
    223218        }
Note: See TracChangeset for help on using the changeset viewer.