aboutsummaryrefslogtreecommitdiffstats
path: root/target-i386/hax-windows.c
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-02-23 07:31:23 -0800
committerandroid code review <noreply-gerritcodereview@google.com>2012-02-23 07:31:25 -0800
commit1991d8c2b6b85170ee1707ca19fe5c746187a77c (patch)
treebcbc52ee128f47fb1d05e200402e60f197a33e25 /target-i386/hax-windows.c
parent1533b3ad6f215e3727ba081ebf6c170c22794c3c (diff)
parent4a5a0efd49f100c7d53920807c83d9c74304ecd8 (diff)
downloadexternal_qemu-1991d8c2b6b85170ee1707ca19fe5c746187a77c.zip
external_qemu-1991d8c2b6b85170ee1707ca19fe5c746187a77c.tar.gz
external_qemu-1991d8c2b6b85170ee1707ca19fe5c746187a77c.tar.bz2
Merge "Check HAXM capability in QEMU"
Diffstat (limited to 'target-i386/hax-windows.c')
-rw-r--r--target-i386/hax-windows.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/target-i386/hax-windows.c b/target-i386/hax-windows.c
index d66ec4a..0035d21 100644
--- a/target-i386/hax-windows.c
+++ b/target-i386/hax-windows.c
@@ -133,6 +133,36 @@ int hax_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t
return 0;
}
+int hax_capability(struct hax_state *hax, struct hax_capabilityinfo *cap)
+{
+ int ret;
+ HANDLE hDevice = hax->fd; //handle to hax module
+ DWORD dSize = 0;
+ DWORD err = 0;
+
+ if (hax_invalid_fd(hDevice)) {
+ dprint("Invalid fd for hax device!\n");
+ return -ENODEV;
+ }
+
+ ret = DeviceIoControl(hDevice,
+ HAX_IOCTL_CAPABILITY,
+ NULL, 0,
+ cap, sizeof(*cap),
+ &dSize,
+ (LPOVERLAPPED) NULL);
+
+ if (!ret) {
+ err = GetLastError();
+ if (err == ERROR_INSUFFICIENT_BUFFER ||
+ err == ERROR_MORE_DATA)
+ dprint("hax capability is too long to hold.\n");
+ dprint("Failed to get Hax capability:%d\n", err);
+ return -EFAULT;
+ } else
+ return 0;
+}
+
int hax_mod_version(struct hax_state *hax, struct hax_module_version *version)
{
int ret;