Next step - ISR, IDT and the rest

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
sparkes

Next step - ISR, IDT and the rest

Post 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.
mystran

Re:Next step - ISR, IDT and the rest

Post 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.
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:Next step - ISR, IDT and the rest

Post 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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Next step - ISR, IDT and the rest

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
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:Next step - ISR, IDT and the rest

Post 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 ?
Post Reply