コード例 #1
0
ファイル: check.c プロジェクト: door/site_blocker
int main() {
	nano_init();

	printf("Tommy check program.\n");

	test_list();
	test_array();
	test_arrayblk();
	test_hashtable();
	test_hashdyn();
	test_hashlin();

	printf("OK\n");

	return EXIT_SUCCESS;
}
コード例 #2
0
ファイル: nano_init.c プロジェクト: PchZhang/testgit
/**
 *
 * @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;
}
コード例 #3
0
ファイル: boot.c プロジェクト: CTSRD-CHERI/cherios
void bootloader_main(void) {

	/* Init hardware */
	hw_init();

	/* Initialize elf-loader environment */
	init_elf_loader();

    /* Load the nano kernel. Doing this will install exception vectors */
    boot_printf("Boot: loading nano kernel ...\n");
	nano_init_t * nano_init = (nano_init_t *)load_nano(); //We have to rederive this as an executable cap
    nano_init = (nano_init_t*)cheri_setoffset(cheri_getpcc(),cheri_getoffset(nano_init));

    /* TODO: we could have some boot exception vectors if we want exception  handling in boot. */
    /* These should be in ROM as a part of the boot image (i.e. make a couple more dedicated sections */
    cp0_status_bev_set(0);

    boot_printf("Boot: loading kernel ...\n");
    size_t entry = load_kernel();

    boot_printf("Boot: loading init ...\n");
    boot_info_t *bi = load_init();

    size_t invalid_length = bi->init_end;
    capability phy_start = cheri_setbounds(cheri_setoffset(cheri_getdefault(), MIPS_KSEG0), invalid_length);

    /* Do we actually need this? */
    //boot_printf("Invalidating %p length %lx:\n", phy_start, invalid_length);
    //caches_invalidate(phy_start, invalid_length);


    register_t mem_size = bi->init_end - bi->nano_end;

    /* Jumps to the nano kernel init. This will completely destroy boot and so we can never return here.
     * All registers will be cleared apart from a specified few. mem_size of memory will be left unmanaged and the
     * rest will be returned as a reservation. The third argument is an extra argument to the kernel */

    boot_printf("Jumping to nano kernel...\n");
    BOOT_PRINT_CAP(nano_init);
    nano_init(mem_size, entry, bi->init_begin - bi->kernel_begin, bi->init_entry);
}