Ignore:
File:
1 edited

Legend:

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

    r25939997 rd28bdbe  
    8080#include <arch/arch.h>
    8181#include <arch.h>
     82#include <arch/faddr.h>
    8283#include <ipc/ipc.h>
    8384#include <macros.h>
     
    173174            ALIGN_UP((uintptr_t) kdata_end - config.base, PAGE_SIZE);
    174175
    175         context_create(&ctx, main_bsp_separated_stack,
     176        context_save(&ctx);
     177        context_set(&ctx, FADDR(main_bsp_separated_stack),
    176178            bootstrap_stack, bootstrap_stack_size);
    177179        context_restore(&ctx);
     
    280282        if (!kinit_thread)
    281283                panic("Cannot create kinit thread.");
    282         thread_start(kinit_thread);
    283         thread_detach(kinit_thread);
    284 
    285         /*
    286          * This call to scheduler_run() will return to kinit,
     284        thread_ready(kinit_thread);
     285
     286        /*
     287         * This call to scheduler() will return to kinit,
    287288         * starting the thread of kernel threads.
    288289         */
    289         current_copy(CURRENT, (current_t *) CPU_LOCAL->stack);
    290         context_replace(scheduler_run, CPU_LOCAL->stack, STACK_SIZE);
     290        scheduler();
    291291        /* not reached */
    292292}
     
    328328        ARCH_OP(post_cpu_init);
    329329
     330        current_copy(CURRENT, (current_t *) CPU->stack);
     331
    330332        /*
    331333         * If we woke kmp up before we left the kernel stack, we could
     
    333335         * switch to this cpu's private stack prior to waking kmp up.
    334336         */
    335         current_copy(CURRENT, (current_t *) CPU_LOCAL->stack);
    336         context_replace(main_ap_separated_stack, CPU_LOCAL->stack, STACK_SIZE);
     337        context_t ctx;
     338        context_save(&ctx);
     339        context_set(&ctx, FADDR(main_ap_separated_stack),
     340            (uintptr_t) CPU->stack, STACK_SIZE);
     341        context_restore(&ctx);
    337342        /* not reached */
    338343}
     
    351356
    352357        semaphore_up(&ap_completion_semaphore);
    353         scheduler_run();
     358        scheduler();
    354359        /* not reached */
    355360}
Note: See TracChangeset for help on using the changeset viewer.