Bochs Debugging

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
LongHorn

Bochs Debugging

Post by LongHorn »

Finally i got my os to switch to DPL3 code. Once i got there page fault happened. It's quite expected because i have all my code running at ring0. So i created pagetables and pagedirectory and copied code to appropriate place. Then i got strange errors. I couldn't find the error.
Bochs goes into a LOOP saying CPU_LOOP1 then i have to close the window explicitly. Bochs log file consists of CR3=user cr3 that i set. But no way it could be there. The errors happen even before task switching

So is there really anyway to break when there is a change in CR3 register. Is it possible? i looked down the bochs docs it seems there is no way. Since errors happens at random place i couldn't figure out errors. Tips on debugging plz. Right now i am tracing on from beginning , a painful task.
paulbarker

Re:Bochs Debugging

Post by paulbarker »

Does anyone think I should add the info about that "CPU_LOOP 1" message to the FAQ?

Just a quick question about this message: do you get the full register dump in the bochs log when this appears?
asmboozer

Re:Bochs Debugging

Post by asmboozer »

paulbarker wrote: Does anyone think I should add the info about that "CPU_LOOP 1" message to the FAQ?

Just a quick question about this message: do you get the full register dump in the bochs log when this appears?
thanks if you do so.
LongHorn

Re:Bochs Debugging

Post by LongHorn »

Just a quick question about this message: do you get the full register dump in the bochs log when this appears?
Yes we do.
It would help a lot if you add that information.
It happens when a triple fault or something like that happens.
hendric

Re:Bochs Debugging

Post by hendric »

LongHorn wrote: Finally i got my os to switch to DPL3 code. Once i got there page fault happened. It's quite expected because i have all my code running at ring0. So i created pagetables and pagedirectory and copied code to appropriate place. Then i got strange errors. I couldn't find the error.
Bochs goes into a LOOP saying CPU_LOOP1 then i have to close the window explicitly. Bochs log file consists of CR3=user cr3 that i set. But no way it could be there. The errors happen even before task switching

So is there really anyway to break when there is a change in CR3 register. Is it possible? i looked down the bochs docs it seems there is no way. Since errors happens at random place i couldn't figure out errors. Tips on debugging plz. Right now i am tracing on from beginning , a painful task.
As my thought,informations you provided were to limited to detect what's happeded to your kernel.You'd better paste your bochs log file here and we will know more about what's going.
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:Bochs Debugging

Post by Pype.Clicker »

LongHorn wrote: So is there really anyway to break when there is a change in CR3 register. Is it possible? i looked down the bochs docs it seems there is no way.
there's no way i know to "watch" the CR3 register (that is, let things running as long as CR3 doesn't change, and act as a breakpoint if it does).

what i'd suggest instead is that you insert breakpoints at code locations where you expect CR3 to change (mov cr3, xxx being an obvious candidate).

If you're desesperately needing this, i suggest you grab bochs sources, find out where CRx is handled and modify the interpreter's code so that it raises a break when a new value is written automatically ...
mystran

Re:Bochs Debugging

Post by mystran »

I want to add that the emulator itself in Bochs is definitely clean enough code that doing such minor tweaks should not be terribly hard.
Post Reply