Page 1 of 1
General protection fault on iret
Posted: Sun Dec 07, 2014 5:31 pm
by digo_rp
Hi all, I have been not developing my os since a long time, now I restart back to develop but I don´t know what I did last time,
now if I enable interrupts and on iret I got general protection fault with error code 0x28,
could anyone help me ? I try change so much things... everything looks right. but...
I don´t know what happens!
sorry about my poor english.
tnx in advance.
Re: General protection fault on iret
Posted: Sun Dec 07, 2014 9:07 pm
by eryjus
I just happen to have the Intel manual open to that page....
Intel wrote:The processor pushes an error code onto the exception handler's stack. If the fault condition was detected while loading a segment descriptor, the error code contains a segment selector to or IDT vector number for the descriptor; otherwise, the error code is 0.
I'm willing to bet Combuster's crystal ball will tell you that you are loading a user-space segment register (like DS) with an associated bad GDT entry. At least that is where I would look first.
Re: General protection fault on iret
Posted: Sun Dec 07, 2014 11:12 pm
by Schol-R-LEA
If I might add something of a side note: it is often useful for us to be able to see the code in question, but if you aren't sure where the problem lies, you may have to post very large sections of code which we would have to wade through. To this end, it may make sense to have your code posted to some site like Pastebin or Google Code, if you are willing to share it. However, since you also should be using
version control - and I hope you are, as it will save you a world of headaches later if you do - it makes the most sense to have your code in an online repository where it can be inspected, updated, and even backtracked by yourself and others who are assisting you. In other words, it would be a great service to both you and anyone helping you if you could join someplace like
SourceForge or
GitHub and make a repo for your code there.
If you do, don't forget to include some sort of
license statement, even if it is just a file saying that the code is free to use so long as you attribute ownership back to you. While I have my own code under the
LGPL for reasons of my own, if you don't want the hassle of that, the
Creative Commons Public Licenses are simple and to the point, and you can choose the one which suits your desires best.
Re: General protection fault on iret
Posted: Mon Dec 08, 2014 1:18 am
by Combuster
eryjus wrote:I'm willing to bet Combuster's crystal ball (...)
I'm just missing the mandatory Bochs log.
Re: General protection fault on iret
Posted: Mon Dec 08, 2014 5:14 am
by digo_rp
tnx so much guys, I was using grub4dos, and when I change to grub 0.97, evething get back to works again...
Thanks so much, a lot!