mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
Kernel: Process available VMWare mouse events immediately
The Qemu I8042 controller does not send one IRQ per event, it sends over four since it will not stop trying to emulate the PS/2 mouse. If the VMWare backdoor is active, a fake I8042 mouse event will be sent that we can then use to check if there are VMWare mouse events present. However, we were only processing one mouse event at a time, even though multiple events could have been queued up. Luckily this does not often lead to issues, since after the first IRQ we would still get three additional interrupts that would then empty the queue. This change makes sure we always empty the event queue immediately, instead of waiting on the next interrupt to happen. Functionally this changes nothing - it could merely improve latency by not waiting for new interrupts to come in. Coincidently, this brings our implementation closer to how Linux deals with the VMMouse.
This commit is contained in:
parent
8a65a9c30f
commit
a4b1c0fd0c
3 changed files with 30 additions and 19 deletions
|
@ -183,22 +183,26 @@ void VMWareBackdoor::send(VMWareCommand& command)
|
|||
command.dx);
|
||||
}
|
||||
|
||||
Optional<MousePacket> VMWareBackdoor::receive_mouse_packet()
|
||||
u16 VMWareBackdoor::read_mouse_status_queue_size()
|
||||
{
|
||||
VMWareCommand command;
|
||||
command.bx = 0;
|
||||
command.command = VMMOUSE_STATUS;
|
||||
send(command);
|
||||
|
||||
if (command.ax == 0xFFFF0000) {
|
||||
dbgln_if(PS2MOUSE_DEBUG, "PS2MouseDevice: Resetting VMWare mouse");
|
||||
disable_absolute_vmmouse();
|
||||
enable_absolute_vmmouse();
|
||||
return {};
|
||||
return 0;
|
||||
}
|
||||
int words = command.ax & 0xFFFF;
|
||||
|
||||
if (!words || words % 4)
|
||||
return {};
|
||||
return command.ax & 0xFFFF;
|
||||
}
|
||||
|
||||
MousePacket VMWareBackdoor::receive_mouse_packet()
|
||||
{
|
||||
VMWareCommand command;
|
||||
command.size = 4;
|
||||
command.command = VMMOUSE_DATA;
|
||||
send(command);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue