29jm / SnowflakeOS

"It is very special"
https://jmnl.xyz
MIT License
316 stars 18 forks source link

Keyboard doesn't work in VirtualBox #19

Closed 29jm closed 3 years ago

29jm commented 3 years ago

The PS/2 controller complains with:

[ps2.c] failed to reset device 0

on VirtualBox, likely on real hardware too, though it'd be good to confirm it.

A good start to fixing this would be to know what part this condition fails, what is actually read from the controller. It could also be interesting to check if removing the whole "reset" part of the initialization fixes things, for some value of fixing things.

Resetting PS/2 devices is described in this part of the wiki, and even there there seems to be some confusion as to what devices reply to the reset command.

29jm commented 3 years ago

See #18 for logs containing the error.

29jm commented 3 years ago

Fixed in https://github.com/29jm/SnowflakeOS/commit/034612fc01764b78bdc7140cd634189912937473.

The PS/2 driver fail was sort of minor, after fixing it, the terminal now crashed on the first movement from the mouse. That issue was with the FPU: the terminal did its thing, including some float work, got interrupted on mouse move, the wm did some float work and got funky results - the FPU being in an undefined state, perhaps in the middle of an operation on the terminal side. Those unexpected results crashed the wm, which got the terminal killed - not really fair, but that's how it is.
The FPU is now reset upon entering the kernel, with its previous state saved, and restored when reentering userspace, taking process switches into account.