Пример #1
0
FUNC_NORETURN void fiber_abort(void)
{
	/* Do normal thread exit cleanup, then give up CPU control */

	_thread_exit(_nanokernel.current);
	_nano_fiber_swap();
}
Пример #2
0
void fiber_abort(void)
{
	_context_exit(_nanokernel.current);
	if (_ScbIsInThreadMode()) {
		_nano_fiber_swap();
	} else {
		_ScbPendsvSet();
	}
}
Пример #3
0
/**
 *
 * @brief Initialize nanokernel
 *
 * This routine is invoked when the system is ready to run C code. The
 * processor must be running in 32-bit mode, and the BSS must have been
 * cleared/zeroed.
 *
 * @return Does not return
 */
FUNC_NORETURN void _Cstart(void)
{
    /* floating point operations are NOT performed during nanokernel init */

    char dummyTCS[__tTCS_NOFLOAT_SIZEOF];

    /*
     * Initialize nanokernel data structures. This step includes
     * initializing the interrupt subsystem, which must be performed
     * before the hardware initialization phase.
     */

    nano_init((struct tcs *)&dummyTCS);

    /* perform basic hardware initialization */

    _sys_device_do_config_level(_SYS_INIT_LEVEL_PRIMARY);

    /*
     * Initialize random number generator
     * As a platform may implement it in hardware, it has to be
     * initialized after rest of hardware initialization and
     * before stack canaries that use it
     */

    RAND32_INIT();

    /* initialize stack canaries */

    STACK_CANARY_INIT();

    /* display boot banner */

    PRINT_BOOT_BANNER();

    /* context switch to main task (entry function is _main()) */

    _nano_fiber_swap();

    /*
     * Compiler can't tell that the above routines won't return and issues
     * a warning unless we explicitly tell it that control never gets this
     * far.
     */

    CODE_UNREACHABLE;
}