My OS Just restarts on pressing any key
My OS Just restarts on pressing any key
Solved.
Last edited by Ycep on Tue Jan 19, 2016 4:53 am, edited 2 times in total.
Re: My OS Just restarts on pressing any key
Clearly something is wrong with your keyboard interrupt or your stack. Time to start debugging.
Re: My OS Just restarts on pressing any key
You might just want to check if the IDT is where you want it to be and wheter you're lidt-ing correctly. Protip: I don't think someone would steal your code to get a system which restarts on keypress...
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: My OS Just restarts on pressing any key
LOL!cmpxchg64 wrote:Protip: I don't think someone would steal your code to get a system which restarts on keypress...
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: My OS Just restarts on pressing any key
...although someone was having trouble resetting their system recently, so they might be interested.cmpxchg64 wrote:Protip: I don't think someone would steal your code to get a system which restarts on keypress...
Not to mention the fact that copyright theft is not a criminal activity.
I'm afraid that sort of copyright claim makes me think "well, I'm certainly not going to look at that guy's code", although how you can claim copyright on something that you admit you have cobbled together from a couple of other sources is a mystery to me.
But, in any case, even without silly claims to copyright I think the onus is on the OP to do a little debugging work rather than asking others to do it for them.
Re: My OS Just restarts on pressing any key
How can i even start debugging?iansjack wrote:Clearly something is wrong with your keyboard interrupt or your stack. Time to start debugging.
Re: My OS Just restarts on pressing any key
You run your OS under a debugger. Bochs, SimNow, or a combination of qemu and gdb are all excellent for this purpose. VirtaulBox also has a built-in debugger, although it can be a little trickier to get to grips with.lukaandjelkovic wrote:How can i even start debugging?iansjack wrote:Clearly something is wrong with your keyboard interrupt or your stack. Time to start debugging.
This is a basic skill that you should master if you want to be successful at OS development. There are other techniques such as printing messages to the screen indicating what point a program has reached and the values of variables/registers.
As you are at a very early stage you have the opportunity now to practice debugging on a very simple system. In the end this is going to be more satisfying, and a lot more instructive, than asking others to debug your program for you.
Alternatively, just inspect your code, making sure that you understand what every line of it does. (This is often a problem when people cut and paste from existing "tutorials" without really understanding what the code does.) The error, in such a simple system, should be self-evident.
Re: My OS Just restarts on pressing any key
You might like to read this Wiki page to get you started: http://wiki.osdev.org/Kernel_Debugging
Re: My OS Just restarts on pressing any key
In general, I dislike the word debugger because it only highlights that you need to have a bug you are trying to catch with a debugger. I think it as a monitor for viewing what happens, and as you know what happens, you write code that is likely to have no bugs to begin with. I think this is the primary function for a debugger, and the secondary function is to help finding bugs that are known to exist because something obviously goes wrong.
Please note that "something obviously goes wrong" is much much better than hidden bugs. By using a debugger proactively, you are concentrating on real problems, i.e. hidden bugs.
Please note that "something obviously goes wrong" is much much better than hidden bugs. By using a debugger proactively, you are concentrating on real problems, i.e. hidden bugs.
Re: My OS Just restarts on pressing any key
this looks like an error inside assembler code of your interrupt handler ! Irq 1
try to find out line by line, every push and pop
cuz if you forgot to pop a pushed value, then you should get wrong value on iret!
try to find out line by line, every push and pop
cuz if you forgot to pop a pushed value, then you should get wrong value on iret!