Пример #1
0
/* --- Kernel entrypoint --- */
int
kernel_main(mbinfo_t *mbinfo, int argc, char **argv, char **envp)
{
    if(handler_install(tick) < 0) {
      panic("oh noes! where are my handlers");
    }

    enable_interrupts();

    clear_console();

    show_cursor();

    set_term_color(FGND_GREEN | BGND_BLACK);

    set_cursor(12, 34);
    printf("Hello World!\n");
    set_cursor(15, 34);
    printf("Type \"cat\" now: \n");

    wait_char('c'); putbyte('d');
    wait_char('a'); putbyte('o');
    wait_char('t'); putbyte('g');
    set_cursor(16, 25);
    printf("That took %d seconds\n", seconds);
    printf("Yay kitties! - now what if you type \"dog\"?");
    while(1)
      continue;
}
Пример #2
0
/* --- Kernel entrypoint --- */
int
kernel_main()
{
    /*
     * Tell the kernel memory allocator which memory it can't use.
     * It already knows not to touch kernel image.
     */

    /* Everything above 16M */
    lmm_remove_free( &malloc_lmm, (void*)USER_MEM_START, -8 - USER_MEM_START );
    
    /* Everything below 1M */
    lmm_remove_free( &malloc_lmm, (void*)0, 0x100000 );

    if(handler_install() < 0) {
      return 0;
    }

    /*
     * initialize the PIC so that IRQs and
     * exception handlers don't overlap in the IDT.
     */
    pic_init( BASE_IRQ_MASTER_BASE, BASE_IRQ_SLAVE_BASE );

    clear_console();

    show_cursor();

    set_term_color(FGND_GREEN | BGND_BLACK);

    set_cursor(12, 34);

    putbytes("Hello World!\n", 13);

    while(1) {
    }

    return 0;
}
Пример #3
0
/** @brief Kernel entrypoint.
 *  
 *  This is the entrypoint for the kernel.  It simply sets up the
 *  drivers and passes control off to game_run().
 *
 * @return Does not return
 */
int kernel_main()
{
    /*
     * Tell the kernel memory allocator which memory it can't use.
     * It already knows not to touch kernel image.
     */

    /* Everything above 16M */
    lmm_remove_free( &malloc_lmm, (void*)USER_MEM_START, -8 - USER_MEM_START );
    
    /* Everything below 1M  */
    lmm_remove_free( &malloc_lmm, (void*)0, 0x100000 );

    /*
     * Install interrupt handlers here.
     */

    handler_install(tick);

    /*
     * initialize the PIC so that IRQs and
     * exception handlers don't overlap in the IDT.
     */
    pic_init( BASE_IRQ_MASTER_BASE, BASE_IRQ_SLAVE_BASE );

    /*
     * allow all interrupts
     */
    enable_interrupts();

    /* 
     * run the game
     */
    game_run();
    
    return 0;
}