LK top lk_main处理

 
lk/top/main.c

/* called from arch code */ void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3) {     // save the boot args     lk_boot_args[0] = arg0;     lk_boot_args[1] = arg1;     lk_boot_args[2] = arg2;     lk_boot_args[3] = arg3;

    // get us into some sort of thread context     thread_init_early();

    // early arch stuff     lk_primary_cpu_init_level(LK_INIT_LEVEL_EARLIEST, LK_INIT_LEVEL_ARCH_EARLY - 1);     arch_early_init();

    // do any super early platform initialization     lk_primary_cpu_init_level(LK_INIT_LEVEL_ARCH_EARLY, LK_INIT_LEVEL_PLATFORM_EARLY - 1);     platform_early_init();

    // do any super early target initialization     lk_primary_cpu_init_level(LK_INIT_LEVEL_PLATFORM_EARLY, LK_INIT_LEVEL_TARGET_EARLY - 1);     target_early_init();

#if WITH_SMP     dprintf(INFO, "\nwelcome to lk/MP\n\n"); #else     dprintf(INFO, "\nwelcome to lk\n\n"); #endif     dprintf(INFO, "boot args 0x%lx 0x%lx 0x%lx 0x%lx\n",             lk_boot_args[0], lk_boot_args[1], lk_boot_args[2], lk_boot_args[3]);

    // bring up the kernel heap     lk_primary_cpu_init_level(LK_INIT_LEVEL_TARGET_EARLY, LK_INIT_LEVEL_HEAP - 1);     dprintf(SPEW, "initializing heap\n");     heap_init();

    // deal with any static constructors     dprintf(SPEW, "calling constructors\n");     call_constructors();

    // initialize the kernel     lk_primary_cpu_init_level(LK_INIT_LEVEL_HEAP, LK_INIT_LEVEL_KERNEL - 1);     kernel_init();

    lk_primary_cpu_init_level(LK_INIT_LEVEL_KERNEL, LK_INIT_LEVEL_THREADING - 1);

    // create a thread to complete system initialization     dprintf(SPEW, "creating bootstrap completion thread\n");     thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);     thread_set_pinned_cpu(t, 0);     thread_detach(t);     thread_resume(t);

    // become the idle thread and enable interrupts to start the scheduler     thread_become_idle(); }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值