Compiling Sample Kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
astrocrep

Compiling Sample Kernel

Post by astrocrep »

Hey all,

I feel like I am back from the dead. I haven't posted in forever. But now Im back into OSDev and am looking for a place to start.

I found this excellent (I think) tutorial kernel called: "Bran's Kernel Development Tutorial" http://osdever.net/bkerndev/index.php?the_id=90 - Full code at end of tutorial.

My native enviornment in Ubuntu 6.06 and I have installed ALL of the build tools.

I began porting the .bat file to a makefile however, my compilation fails when compiling irq.c

Code: Select all

void irq_handler(struct regs *r)
{
    /* This is a blank function pointer */
    void (*handler)(struct regs *r);

    /* Find out if we have a custom handler to run for this
    *  IRQ, and then finally, run it */
    handler = irq_routines[r->int_no - 32];
    if (handler)
    {
        handler(r);
    }

    /* If the IDT entry that was invoked was greater than 40
    *  (meaning IRQ8 - 15), then we need to send an EOI to
    *  the slave controller */
    if (r->int_no >= 40)
    {
        outportb(0xA0, 0x20);
    }

    /* In either case, we need to send an EOI to the master
    *  interrupt controller too */
    outportb(0x20, 0x20);
}

It fails on these lines:

handler = irq_routines[r->int_no - 32];
if (r->int_no >= 40)

Unfortuantly I don't have the error on my as I am at work right now, but it has to do with the type of the object.

Is this a good place to start messing around with a very light and thin kernel? Perhaps theres a better one.

I liked this one because it was just a very thin and solid foundation to start toying with.

Thanks,
-Rich
Cjmovie

Re:Compiling Sample Kernel

Post by Cjmovie »

You should be able to fix it by first adding this to somewhere:

typedef (void*)(struct regs *r) t_func;

then casting handler to it:

handler = (t_func)irq_routines[r->int_no - 32];
astrocrep

Re:Compiling Sample Kernel

Post by astrocrep »

I got everything compiling... but am having a linking problem...

See the other thread about Brans Tutorial.

Thanks,
Rich
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Compiling Sample Kernel

Post by Pype.Clicker »

if you're moving from .bat to ubuntu, i guess your linking problem might be due to leading underscores that are prepended by default in MS environment and (virtually) nowhere else.
Post Reply