OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:36 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Continous unhandled interrupt 6 on James Molly PIC/timer ex.
PostPosted: Wed Jun 29, 2022 2:01 pm 
Offline

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


Top
 Profile  
 
 Post subject: Re: Continous unhandled interrupt 6 on James Molly PIC/timer
PostPosted: Wed Jun 29, 2022 3:22 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: Continous unhandled interrupt 6 on James Molly PIC/timer
PostPosted: Thu Jun 30, 2022 1:40 pm 
Offline

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 65 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group