ChorusOS 4.0 Porting Guide

kernel_start()

The kernel_start() function calls binInstallByMask() (see "binInstallByMask and binInstallByType()") to install the microkernel and all actors that belong to the initial kernel address space. It then retrieves the descriptor pointing to the microkernel binary and jumps to the microkernel entry point, passing the address of the bootConf structure to the microkernel as an argument.

kernel_start() also informs the system debugger that the microkernel was installed in the dedicated memory. From this moment, the debugger has access to the microkernel memory, in order to set break points, for example

kernel_start() assumes that the memory banks containing the microkernel and the installing actors have already been installed and that the destination addresses are already accessible.

Example 3-10 is kernel_start() source code provided in kernel/snippet/nucleus/boot_tools/kernel_start.c.


Example 3-10 kernel_start()

void
kernel_start()
{
    int i;

    /*
     * Install all u-kernel's and actor's KSP sections
     */
    binInstallByMask(BIN_KERNEL | BIN_ACTOR);

    /*
     * Report to the debug agent that the kernel was installed in the memory
     * dedicated for it.
     */
    bootConf->dbgOps.kernelInitLevel(KERNEL_INSTALLED);

    /*
     * Jump to the u-kernel
     */
    for (i = 0; i < bootConf->numBins; ++i) {
        BinDesc* bin = &bootConf->binDesc[i];
        if (bin->type == BIN_KERNEL) {
            (* (KernelEntry) bin->entry)(bootConf);
        }
    }
}