view withGRUB2Kernel/kernel.cbc @ 14:acdc2c21996a

chage directory structure
author Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp>
date Wed, 05 Sep 2012 11:49:15 +0900
parents
children
line wrap: on
line source

__code memory(int state);
__code kernel(int state);
void init(int state);

__code put_to_vmem(unsigned char* str, unsigned short *video)
{
    char c;
    if ((c=*(str++))!=0) {
        *video++ = (0x0E << 8) | c;
        goto put_to_vmem(str, video);
    } else {
        goto kernel(3);
    }
}


__code putchar(int state)
{
    unsigned short *video = (unsigned short *)0xb8000;
    unsigned char *str = (unsigned char *)"hello,world";

    goto put_to_vmem(str, video);

    goto kernel(2);
}

__code kernel(int state)
{
    switch(state) {
        case 1:
            goto putchar(3);
            break;
        case 2:
            goto memory(state);        
            break; 
    }
    goto kernel(state);
}

__code memory(int state)
{
    if (state == 1) {
        goto kernel(state);
    }
    init(state);
}

void
init(int state)
{
    goto kernel(state);
}

int
kmain(unsigned long magic, unsigned long addr)
{
    int state = 1;
    init(state);
    return 0;
}