Page 1 of 1

Next step - ISR, IDT and the rest

Posted: Fri Jan 21, 2005 4:02 pm
by sparkes
Hi, another newbie question to bother the regulars.

Using grub I managed to get a booting kernel in about an hour. I couldn't believe how easy this first step was (considering I once spent a week writing a boot loader that didn't ever really work ;-) ) but now I have spent two days doing what seems like standing still.

The system boots up and has some nice console output routines, displays the amount of ram it has and then does nothing.

Are there any examples of a working IDT and ISR in gcc style C (ie no interupt keyword) with as little as possble ASM in GAS syntax?

I feel like I have read the same examples time and time again and still don't understand them :-( I'm not normally this dense ;-)

thanks in advance.

Re:Next step - ISR, IDT and the rest

Posted: Fri Jan 21, 2005 10:45 pm
by mystran
Grab your favourite version of Linux kernel. 2.4 series at least are quite easy to read. Haven't looked at 2.6 yet, but I'd imagine there aren't any big changes.

The stuff you are interested in is under "arch/i386/kernel". It looks huge at first, but the main kernel is really quite small and easy to understand, and since it's widely and actively used, you could assume it really works. Also, the tricky parts of Linux are really quite well commented.

Personally, I found reading the Linux source MUCH more enlightening than any of the examples (or example kernels) I found.

Re:Next step - ISR, IDT and the rest

Posted: Sun Jan 23, 2005 2:29 am
by Pype.Clicker
you shouldn't try to completely skip ASM in interrupts, really ... you may wish to check out the OSFAQ which contains a default ISR stub, calling a C function in the appropriate environment.

Re:Next step - ISR, IDT and the rest

Posted: Mon Jan 24, 2005 5:55 am
by Brendan
Hi,
Pype.Clicker wrote: you shouldn't try to completely skip ASM in interrupts, really ...
It's funny how 2 different people can get 2 completely different meanings from the same words - I read "with as little as possible ASM in GAS syntax" to mean that a large chunk of NASM source code would be fine (I don't like GAS much myself) :).

BTW doesn't C have an "interrupt" keyword (e.g. "interrupt void interruptHandler(void) {}")?


Cheers,

Brendan

Re:Next step - ISR, IDT and the rest

Posted: Mon Jan 24, 2005 6:24 am
by Pype.Clicker
no, C doesn't have an "interrupt" keyword. Some specific C compilers extends the language with "interrupt" modifier, but it's not something defined in a standard -- and among other things it's not something supported in our beloved GCC.

note: we have "i can't get interrupts working" page in the FAQ. did it help you in any way ?