code optimization
Posted: Fri Mar 18, 2011 6:51 am
I have been starting to write my first os in c but I have a question concerning optimisation by the compiler.
I have written an interupt handler and for testing that it works I have put a simple printk() inside which writes to the screen whenever I receive an interupt.
So my ouput would be something like:
"Interupt fired: 0x03"
When I compile my code with -O however I get a page full of: "Interupt fired:0x0d after the normal 0x3 interupt has been fired.
So I looked at the error part of the Global Protection Fault and checked the address in my kernel disasembly.
And this was somewhere in the .bss section where my GDT pointer is.
So my question is how can optimization affect this and how do I go about debugging this and fixing it?
I'm a bit stuck in this so any help would bring much rejoicing
Thanks,
Otenki
I have written an interupt handler and for testing that it works I have put a simple printk() inside which writes to the screen whenever I receive an interupt.
So my ouput would be something like:
"Interupt fired: 0x03"
When I compile my code with -O however I get a page full of: "Interupt fired:0x0d after the normal 0x3 interupt has been fired.
So I looked at the error part of the Global Protection Fault and checked the address in my kernel disasembly.
And this was somewhere in the .bss section where my GDT pointer is.
So my question is how can optimization affect this and how do I go about debugging this and fixing it?
I'm a bit stuck in this so any help would bring much rejoicing
Thanks,
Otenki