IDT & Optimization

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.
User avatar
hometue
Member
Member
Posts: 100
Joined: Thu Dec 19, 2013 1:40 am
Location: Asia, Singapore

Re: IDT & Optimization

Post by hometue »

The bad luck number?? Does that mean the system detected bad luck?? (Sorry, just felt like making that distasteful joke, don't mind me)
CookieOS. Want a cookie? Its only black and white for now though, probably as bad as my baking skills.
inixsoftware
Member
Member
Posts: 32
Joined: Fri Jan 31, 2014 8:21 am

Re: IDT & Optimization

Post by inixsoftware »

So I got a Global Protection Fault. What would cause that to happen?
Would an invalid IDT trigger it?
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: IDT & Optimization

Post by Nable »

inixsoftware wrote:So I got a Global Protection Fault. What would cause that to happen?
Would an invalid IDT trigger it?
Look attentively, Bochs tells you about invalid IDT entry and even says what he finds invalid:

Code: Select all

00128266044e[CPU0 ] interrupt(): gate.type(9) != {5,6,7,14,15}
00128266044e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00128266044e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
Some above lines may be also important but you should have noticed at least these ones.
inixsoftware
Member
Member
Posts: 32
Joined: Fri Jan 31, 2014 8:21 am

Re: IDT & Optimization

Post by inixsoftware »

OK, I get that. However, how did an -O3 optimization cause this issue, while -O2 doesn't. That is my question.
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: IDT & Optimization

Post by Nable »

inixsoftware wrote:OK, I get that. However, how did an -O3 optimization cause this issue, while -O2 doesn't. That is my question.
Try reading Brendan's and Sortie's answers once again, you can find some possible answers to "how" question there.

I can add an idea about debugging: put a breakpoint on 'idt_set_gate' and examine IDT with (AFAIR) 'info idt' command of Bochs debugger after each return from this function (comparing results with parameters that were passed to function. If this procedure doesn't help, then it's possible that you enable interrupts too early or smth like that.
Post Reply