OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 25, 2024 1:23 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Day 4 of debugging a previously functional PS/2 Mouse Driver
PostPosted: Sat Aug 01, 2020 9:14 am 
Offline

Joined: Sat May 20, 2017 6:29 am
Posts: 7
Hi all,

I've been spending the last few days banging my head against the wall with regard to my PS/2 mouse implementation.

For a bit of context, I recently built a test system out of old hardware (Gigabyte Board with an old AMD Vishera 8350) + PiKVM (Raspberry Pi acting as a Keyboard/Video/Mouse over the network) for testing my OS on real hardware. Previously, I've mainly been using VirtualBox/QEmu/Bochs for testing, occasionally testing on an old laptop or my main rig.

The mouse driver has worked fine up until now when tested in virtualized environments or on real hardware. However, with the new test rig, initializing the mouse causes a triple fault when switching to Data Reporting mode (outb(0x60, 0xF4);). Port 60/64 emulation is enabled in the BIOS/SMM, but as soon as the call to enable Data Reporting mode is called the system triple faults and as such, resets.

The PIC is rebased to 32, and as such, I'd expect IRQ 44 (32 + 12) to be the PS/2 mouse Data Reporting.

NB: The keyboard seems to be fully functional.

I have enabled debug output through RS232 serial, and this is what I've tried so far:
- Traced the code using lots of verbose output & infinite loops - this traced to outb(0x60, 0xF4), everything before this runs fine.
- Disabling the PS/2 mouse driver - System boots without issue.
- Commenting out the mouse_write(0xF4)/outb(0x60, 0xF4) - System boots without issue.
- Checking to see if IRQ44 is called at all by writing out to serial - Interrupt doesn't seem to be called before the triple fault.
- Disabling the PCI driver (it was mentioned by doug16k on the IRC that touching/clearing the BARs of the USB to check sizes can mess up PS/2 emulation) - Disabling the PCI initialization didn't seem to solve the issue.
- Checking that other interrupts are functioning correctly - The PIT at IRQ32 seems to be firing correctly.

Does anyone have any tips/pointers? I feel like I must be missing something, but I can't for the life of me work out what.

Source for reference (apologies, I haven't renewed the certificate on the web svn viewer):
- Mouse Driver: https://svn.spexeah.com/!/#Asuro/view/h ... /mouse.pas
- PIC Init/Rebase: https://svn.spexeah.com/!/#Asuro/view/head/src/irq.pas
- ISR Manager: https://svn.spexeah.com/!/#Asuro/view/h ... anager.pas

If there's any more information I can provide, or you would prefer the source in disassembled ASM format as opposed to Pascal, please ask - any help would be massively appreciated.

Regards,

t3hn3rd


Top
 Profile  
 
 Post subject: Re: Day 4 of debugging a previously functional PS/2 Mouse Dr
PostPosted: Sat Aug 01, 2020 11:59 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5145
You've checked your exception handlers and you're sure it's triple faulting while in SMM, right?

Have you tried it without the Pi-KVM?

Do other users of the SMM USB stack have the same issue? (For example, DOS with a PS/2 mouse driver.)


Top
 Profile  
 
 Post subject: Re: Day 4 of debugging a previously functional PS/2 Mouse Dr
PostPosted: Thu Aug 06, 2020 6:18 am 
Offline

Joined: Sat May 20, 2017 6:29 am
Posts: 7
Octocontrabass wrote:
You've checked your exception handlers and you're sure it's triple faulting while in SMM, right?

I have checked, and it doesn't seem to run any instructions after the outb, data report interrupt code doesn't seem to be run either.

Octocontrabass wrote:
Have you tried it without the Pi-KVM?

I've tried it with a standard USB mouse and have the same issue.

Octocontrabass wrote:
Do other users of the SMM USB stack have the same issue? (For example, DOS with a PS/2 mouse driver.)

I haven't tried that yet, very good idea - I'll download DOS + PS/2 Mouse Driver and give this a go. I have every faith that it's my code as opposed to an SMM issue though :P

Regards,

t3hn3rd


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 230 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