General Protection Fault, Interrupts, printf();... Is there

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
Warmaster199

General Protection Fault, Interrupts, printf();... Is there

Post by Warmaster199 »

Hello people, I am having a major problem with my OS. It seems like I cannot pass any arguments to printf(); from within an interrupt function. I can say printf("A key was pressed"); or putch(char); from my keyboard interrupt function, but as soon as printf is given an argument such as printf("stuff = %d", stuff); from within my keyboard interrupt function, I generate a General Protection Fault when printf(); returns. This is proving to be VERY annoying for me. Right after this, the timer fires and it prints "[t]" on the screen. Welcome to my nightmare... The screen is flooded with "Invalid Opcode". I am guessing that there is some kind of error with either the stack or printf(); or both :o

Is it possible that something could have royally messed up in my printf(); function? Or does ebp or esp have to be reset after a call to it? Please help, this is fairly important.
roswell

Re:General Protection Fault, Interrupts, printf();... Is the

Post by roswell »

Hi,

If you need some help, you must provide some code. So you can try to submit one piece of your code here or send me some files by mail [email protected].

roswell
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:General Protection Fault, Interrupts, printf();... Is the

Post by Pype.Clicker »

i think one of the most useful thing you could try is write some "dump registers & stack" function in ASM (because you'll better see what you do) and study where exactly things goes wrong ...

i've got such a debugging function in my crash() S.O.S. call that you might find helpful. see here
Warmaster199

Re:General Protection Fault, Interrupts, printf();... Is the

Post by Warmaster199 »

That's mainly what the F12 key was supposed to be for CTOS. The problem is that when I press that key, the error happens... I think I have a debug solution, but my friend is using my ONLY floppy disk because he just got a computer AMD PC(Athlon 1.6G)and is wanting Sonique plugins, so I cannot test. I have Bochs, but I find it a bit of a hassel, it's better to boot my kernel on my old 486...
Post Reply