Bochs bug?

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
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Bochs bug?

Post by earlz »

is anyone sure if this is a bochs bug?
Ok, well, I'm trying to test the double fault stuff, so I divide by zero to get to the div0 exception handler, and then in the exception handler, I divide by zero again.. if I do this, there are many things that can go wrong... I usually get a panic with "prefetch >> running in bogus memory" and sometimes I get something like "Message: prefetch: getHostMemAddr vetoed direct read, pAddr=0xa0000" and such... with the prefetch error, I can't find what the eip is or anythign when this happens, but for the second message, bochs will still dump all of the registers.. and it says eip is 0xA0000, and esp is 0xFFFFFFFF and other weird things...

but, if I remove the divide by zero in the exception handler, it all works just fine.

any ideas on testing the doubel fault handler if this is a bug?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Bochs bug?

Post by Combuster »

From what I got out of the intel manuals is that double exceptions only occur when it fails to transfer control to a different exception handler. So if you cause a completely separate error (another division by zero), the processor is able to properly deal with it, reentering the exception handler (and in your case, causing a loop resulting in the stack being run over, with all the hairy effects of that)

But the manual's rather cryptic and there's possibly another different explanation that arguably fits the text.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Candy
Member
Member
Posts: 3883
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: Bochs bug?

Post by Candy »

It's only a double fault if it cannot start running the exception handler for the first exception. That means, segment swapped out, invalid IDT entry, stuff like that. If it can *start* with the 1st instruction, it's a single fault again (which will be handled simply).
Post Reply