Zircon 初始化kernel到user procss

本文详细介绍了Zircon系统在初始化过程中,如何从kernel调用hook函数,执行entry点,传递参数,并通过channel消息启动user进程bootsvc的过程。这一过程涉及的关键文件包括BUILD.gn和start.cc,以及kernel传递的cmd line选项。通过对代码的回溯,读者可以深入理解Zircon的启动机制。

承接上篇,Zircon初始化启动,调用hook函数:

void userboot_init(uint) 

从函数结尾部分看到:

 // Start the process's initial thread.
    auto arg1 = static_cast<uintptr_t>(hv);
    status = thread->Start(
        ThreadDispatcher::EntryState{entry, sp, arg1, vdso_base},
        /* initial_thread= */ true);
    ASSERT(status == ZX_OK);

    init_time.Add(current_time() / 1000000LL);

执行PC地址为entry,参数为arg1以及vdso_base

回溯entry code

 // Map in the userboot image along with the vDSO.
    UserbootImage userboot(vdso);
    uintptr_t vdso_base = 0;
    uintptr_t entry = 0;
    status = userboot.Map(vmar, &vdso_base, &entry);
    ASSERT(status == ZX_OK);

回溯vdso,

// It also gets many VMOs for VDSOs and other things.
    const VDso* vdso = VDso::Create();
    vdso->GetVariants(&handles[kFirstVdso])
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值