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.
Next step - ISR, IDT and the rest
Re:Next step - ISR, IDT and the rest
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.
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.
- Pype.Clicker
- 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
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
Hi,
BTW doesn't C have an "interrupt" keyword (e.g. "interrupt void interruptHandler(void) {}")?
Cheers,
Brendan
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) .Pype.Clicker wrote: you shouldn't try to completely skip ASM in interrupts, really ...
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.
- Pype.Clicker
- 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
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 ?
note: we have "i can't get interrupts working" page in the FAQ. did it help you in any way ?