예제 #1
0
파일: refos_nethack.c 프로젝트: seL4/refos
int
main(int argc, char **argv)
{
    /* Future Work 3:
       How the selfloader bootstraps user processes needs to be modified further. Changes were
       made to accomodate the new way that muslc expects process's stacks to be set up when
       processes start, but the one part of this that still needs to changed is how user processes
       find their system call table. Currently the selfloader sets up user processes so that
       the selfloader's system call table is used by user processes by passing the address of the
       selfloader's system call table to the user processes via the user process's environment
       variables. Ideally, user processes would use their own system call table.
    */

    uintptr_t address = strtoll(getenv("SYSTABLE"), NULL, 16);
    refos_init_selfload_child(address);
    refos_stdio_translate_stdin_cr = true;
    refos_initialise();
    printf("RefOS nethack.\n");
    setenv("PWD", "fileserv/", true);

#if REFOS_NETHACK_WIZARD_MODE
    char *_argv[] = {_argv0, _argv1};
    int _argc = 2;
#else
    char *_argv[] = {_argv0 };
    int _argc = 1;
#endif

    nethack_main(_argc, _argv);
}
예제 #2
0
파일: tetris.c 프로젝트: seL4/refos
int
main()
{
    /* Future Work 3:
       How the selfloader bootstraps user processes needs to be modified further. Changes were
       made to accomodate the new way that muslc expects process's stacks to be set up when
       processes start, but the one part of this that still needs to changed is how user processes
       find their system call table. Currently the selfloader sets up user processes so that
       the selfloader's system call table is used by user processes by passing the address of the
       selfloader's system call table to the user processes via the user process's environment
       variables. Ideally, user processes would use their own system call table.
    */

    uintptr_t address = strtoll(getenv("SYSTABLE"), NULL, 16);
    refos_init_selfload_child(address);
    int c, i, *ptr;
    int delay = INITIAL_DELAY_MS;
    refos_initialise();

    peekShape = NULL;

    /* Initialise board. */
    ptr = board;
    for (i = B_SIZE - 1; i>=0; i--) {
        *ptr++ = i < 25 || i % B_COLS < 2 ? A_BG_W : RESETATTR;
    }

    srand((unsigned int) RANDOM_SEED);

    clrscr();

    print_welcome_message();
    printf("      Press the space bar to continue...\n");
    show_online_help();

    while (1) {
        c = io_nonblock_getkey();
        rand();
        if (c == ' ') break;
    }
    clrscr();
    show_online_help();

    /* Main game loop. */
    shape = next_shape();
    while (!exitGame) {
        c = io_nonblock_getkey();
        rand();
        if (c >= 0) {
            game_frame(c);
        } else {
            game_frame(0);
            usleep((delay - level * LEVEL_DECREASE_DELAY_MS) * 1000);
        }
    }

    gotoxy (0, 25);
    printf("Game over! You reached %d points.\n", points);
}
예제 #3
0
파일: timer_server.c 프로젝트: buaakq/RefOS
/*! @brief Main timer server entry point. */
int
main(void)
{
    SET_MUSLC_SYSCALL_TABLE;
    //dprintf("Initialising RefOS timer server.\n");
    refosio_setup_morecore_override(timeServMMapRegion, TIMESERV_MMAP_REGION_SIZE);
    refos_initialise();
    timeserv_init();

    test_server();

    //timer_server_mainloop();

    return 0;
}