Page 1 of 1

Help needed in implementing PS/2 mouse

Posted: Fri Feb 20, 2026 12:44 am
by Afifalisaadman
:!: Warning : Bad code alert. Dont yell at me for enabling SSE. I will do full krnl mode. No trolls please

Hi,
I am trying to implement PS/2 mouse in my OS. But, even though it initializes successfully, it does not show ANY kind of data. I am using legacy PIC only(i disabled apic).
I need answers to these questions:
1. Is my code /logic incorrect ? If so,what is the solution?
2. Is the problem my code or my QEMU config or my QEMU build/version?
3. If it's not possible to implement PS/2, do I need to implement UHCI? Also, What kind for file system I should mount on the mouse? A fakefs or a virtfs?

Neccessary Info
1. Code: https://github.com/afifafifafifafifali/ ... /tree/main
2. QEMU Build: 4.2.0 (v4.2.0-11797-g2890edc853-dirty) (x86_64,windows exe, use this URL to install:https://drive.google.com/file/d/15PZQJC ... sp=sharing)

Re: Help needed in implementing PS/2 mouse

Posted: Fri Feb 20, 2026 12:44 pm
by Octocontrabass
Afifalisaadman wrote: Fri Feb 20, 2026 12:44 amIs my code /logic incorrect ?
The mouse and keyboard are both connected to the same PS/2 controller. Your mouse driver directly accesses the PS/2 controller, so it can (and probably will) interfere with your keyboard driver.

There is a race condition. You enable IRQs before you install your IRQ handler.
Afifalisaadman wrote: Fri Feb 20, 2026 12:44 amAlso, What kind for file system I should mount on the mouse? A fakefs or a virtfs?
Since when can you mount a filesystem on a mouse?