2020-02-04 01:00:50 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-02-04 01:00:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-04-08 14:35:00 +00:00
|
|
|
#include <AK/Optional.h>
|
2020-02-04 01:00:50 +00:00
|
|
|
#include <AK/Types.h>
|
2020-04-08 13:34:26 +00:00
|
|
|
#include <AK/kmalloc.h>
|
2020-07-04 15:22:23 +00:00
|
|
|
#include <Kernel/API/MousePacket.h>
|
2020-02-04 01:00:50 +00:00
|
|
|
|
2020-02-16 00:27:42 +00:00
|
|
|
namespace Kernel {
|
|
|
|
|
2020-02-04 01:00:50 +00:00
|
|
|
#define VMMOUSE_GETVERSION 10
|
|
|
|
#define VMMOUSE_DATA 39
|
|
|
|
#define VMMOUSE_STATUS 40
|
|
|
|
#define VMMOUSE_COMMAND 41
|
|
|
|
|
|
|
|
struct VMWareCommand {
|
|
|
|
union {
|
|
|
|
u32 ax;
|
|
|
|
u32 magic;
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
u32 bx;
|
|
|
|
u32 size;
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
u32 cx;
|
|
|
|
u32 command;
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
u32 dx;
|
|
|
|
u32 port;
|
|
|
|
};
|
|
|
|
u32 si;
|
|
|
|
u32 di;
|
|
|
|
};
|
|
|
|
|
|
|
|
class VMWareBackdoor {
|
2020-04-08 13:34:26 +00:00
|
|
|
AK_MAKE_ETERNAL;
|
|
|
|
|
2020-02-04 01:00:50 +00:00
|
|
|
public:
|
2020-08-25 01:35:19 +00:00
|
|
|
VMWareBackdoor();
|
2020-04-08 14:35:00 +00:00
|
|
|
static VMWareBackdoor* the();
|
|
|
|
|
|
|
|
bool vmmouse_is_absolute() const;
|
2020-02-04 01:00:50 +00:00
|
|
|
void enable_absolute_vmmouse();
|
|
|
|
void disable_absolute_vmmouse();
|
|
|
|
void send(VMWareCommand& command);
|
|
|
|
|
2020-04-08 14:35:00 +00:00
|
|
|
Optional<MousePacket> receive_mouse_packet();
|
|
|
|
|
2020-02-04 01:00:50 +00:00
|
|
|
private:
|
2020-02-05 17:38:45 +00:00
|
|
|
void send_high_bandwidth(VMWareCommand& command);
|
|
|
|
void get_high_bandwidth(VMWareCommand& command);
|
2020-02-04 01:00:50 +00:00
|
|
|
bool detect_vmmouse();
|
|
|
|
bool m_vmmouse_absolute { false };
|
|
|
|
};
|
2020-02-16 00:27:42 +00:00
|
|
|
|
|
|
|
}
|