Can bochs trace "IRET"?

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
raywill

Can bochs trace "IRET"?

Post by raywill »

I am debugging my ISR.

I placed two nop and a hlt before iret.
I use 's' command to step over each instruction
It goes well before ISR does iret.

But when it comes to IRET,the debugger freezed.Just like this:

Code: Select all

(0) [0x00009f18] 0010:00009f18 (unk. ctxt): nop                       ; 90
<bochs:132> s
Next at t=-675184644
(0) [0x00009f19] 0010:00009f19 (unk. ctxt): hlt                       ; f4
<bochs:133> s
Next at t=-675184643
(0) [0x00009f1a] 0010:00009f1a (unk. ctxt): add esp, 0x8              ; 81c40800
0000
<bochs:134> s
_(this is the cursor)
I have to use ctrl+c to make my program continue.Again,it comes to the timer interrupt's beginning.A loop!

by the way,if I enable keyboard and disable timer,there is similar problem.

I use the way of keeping print 'S' to see if my program is not in ISR.So,I think,when ISR returned ,it should continue to print 'S'.But the problem is screen freezed.

I think the debugger should return to where it was before the interrupt occured after doing 'iret'.

Can anyone explain this problem?
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:Can bochs trace "IRET"?

Post by Pype.Clicker »

wait a minute, i'm having trouble getting what's going on here ...

you put a "hlt" opcode within your interrupt handler ?

i don't remember of having any trouble with "iret" ...

Code: Select all

<bochs:49> disas 0x11b7f1 0x11b7f6
0011b7f1: (                    ): pop es                    ; 07
0011b7f2: (                    ): pop ds                    ; 1f
0011b7f3: (                    ): popad                     ; 61
0011b7f4: (                    ): pop ebp                   ; 5d
0011b7f5: (                    ): iretd                     ; cf
<bochs:27> break 0x11b7f5
<bochs:28> c
(0) Breakpoint 5, 0x11b7f5 in ?? ()
Next at t=302280708
(0) [0x0011b7f5] 0008:0011b7f5 (unk. ctxt): iretd                     ; cf 
<bochs:45> print-stack
   00c73f9c [0108ff9c]  13bcc9
   00c73fa0 [0108ffa0]  0008
   00c73fa4 [0108ffa4]  0212
   ...
<bochs:46> s
Next at t=302418023
(0) [0x0013bcc9] 0008:0013bcc9 (unk. ctxt): mov dword ptr ss:[esp], 0x13f730 ; c7042430f71300
just a last-minute though: what version of bochs are you using ?
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Re:Can bochs trace "IRET"?

Post by Kevin McGuire »

Try:

hlt
nop
nop

The reason is that when bochsdbg stop at hlt, and you press ctrl+c it jumps to the second one in the debugger. I don't think it actually skips a instruction, but anyway it should work with the above.
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Re:Can bochs trace "IRET"?

Post by Kevin McGuire »

If bochs is actually freezing up, I do not know it has to be a bug. If you mean it just continues running it is because you need two nops after the hlt.
Post Reply