Continous unhandled interrupt 6 on James Molly PIC/timer ex.

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
optimisticnugget
Posts: 8
Joined: Wed Mar 02, 2022 4:21 pm

Continous unhandled interrupt 6 on James Molly PIC/timer ex.

Post by optimisticnugget »

I had quite a bit of of my own code working, now I'm getting (continuous) unhandled interrupt 6 on everything. I know this means invalid opcode, and I assume the reason is, that it keeps attempting to execute illegal code, which calls the interrupt handler, again and again. However, even when I simply want to go back to the beginning and look again at James Molly's code with no modifications, that also gives me unhandled interrupt 6 (!), on everything from the PIC and timer example, and up.

Obviously this is my own doing, somehow. I just can't figure it out. I did notice that my system updated bochs to 2.7.2, so I downgraded to 2.7.1, but I still have the same issue (I didn't expect this to work).

I'm hoping that someone with experience would have a good idea of what the problem is, I guess that's a long shot and I should just get better at debugging with bochs. I can single step through the continuous interrupts as they get received, but I don't really recognize the code that's being run, the whole this is just weird.

This is from single stepping when it just keeps throwing "unhandled interrupt 6":

Code: Select all

(0) [0x00000010014d] 0008:000000000010014d (unk. ctxt): mov edx, dword ptr ds:[eax-3128] ; 8b90c8f3ffff
<bochs:327>
Next at t=545748683
(0) [0x000000100153] 0008:0000000000100153 (unk. ctxt): mov ecx, dword ptr ss:[ebp-8] ; 8b4df8
<bochs:328>
Next at t=545748684
(0) [0x000000100156] 0008:0000000000100156 (unk. ctxt): add ecx, 0x00000050       ; 83c150
<bochs:329>
Next at t=545748685
(0) [0x000000100159] 0008:0000000000100159 (unk. ctxt): add ecx, ecx              ; 01c9
<bochs:330>
Next at t=545748686
(0) [0x00000010015b] 0008:000000000010015b (unk. ctxt): add edx, ecx              ; 01ca
<bochs:331>
Next at t=545748687
(0) [0x00000010015d] 0008:000000000010015d (unk. ctxt): mov ecx, dword ptr ds:[eax-3128] ; 8b88c8f3ffff
<bochs:332>
Next at t=545748688
(0) [0x000000100163] 0008:0000000000100163 (unk. ctxt): mov ebx, dword ptr ss:[ebp-8] ; 8b5df8
<bochs:333>
Next at t=545748689
(0) [0x000000100166] 0008:0000000000100166 (unk. ctxt): add ebx, ebx              ; 01db
<bochs:334>
Next at t=545748690
(0) [0x000000100168] 0008:0000000000100168 (unk. ctxt): add ecx, ebx              ; 01d9
<bochs:335>
Next at t=545748691
(0) [0x00000010016a] 0008:000000000010016a (unk. ctxt): movzx edx, word ptr ds:[edx] ; 0fb712
<bochs:336>
Next at t=545748692
(0) [0x00000010016d] 0008:000000000010016d (unk. ctxt): mov word ptr ds:[ecx], dx ; 668911
Next at t=545748693
(0) [0x000000100170] 0008:0000000000100170 (unk. ctxt): add dword ptr ss:[ebp-8], 0x00000001 ; 8345f801
<bochs:338>
Next at t=545748694
(0) [0x000000100174] 0008:0000000000100174 (unk. ctxt): cmp dword ptr ss:[ebp-8], 0x0000077f ; 817df87f070000
<bochs:339>
Next at t=545748695
(0) [0x00000010017b] 0008:000000000010017b (unk. ctxt): jle .-48  (0x0010014d)    ; 7ed0
Not that I expect anyone to go through the effort of downloading and running, but in case anyone is curious about what I mean by the "PIC and timer example", here it is:

http://www.jamesmolloy.co.uk/tutorial_h ... pit.tar.gz
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Continous unhandled interrupt 6 on James Molly PIC/timer

Post by Octocontrabass »

Have you been fixing the tutorial's bugs along the way?

Your single-step log shows code that scrolls text on the screen. It's not helpful for debugging this issue. (Sometimes it will be helpful, and you might want to practice using tools like addr2line and objdump to identify the code you're stepping through.)

You need to find the address of the faulting instruction. Update your exception handler to display the saved EIP and halt. Consider displaying the rest of the saved CPU state too.
optimisticnugget
Posts: 8
Joined: Wed Mar 02, 2022 4:21 pm

Re: Continous unhandled interrupt 6 on James Molly PIC/timer

Post by optimisticnugget »

Octocontrabass wrote:Have you been fixing the tutorial's bugs along the way?

Your single-step log shows code that scrolls text on the screen. It's not helpful for debugging this issue. (Sometimes it will be helpful, and you might want to practice using tools like addr2line and objdump to identify the code you're stepping through.)

You need to find the address of the faulting instruction. Update your exception handler to display the saved EIP and halt. Consider displaying the rest of the saved CPU state too.
I fixed some of them, without following that list though. :)

This shouldn't be related to that, as the example has been running before, I have no idea what is going on. Your suggestion is great though, thanks!
Post Reply