Merge "Check HAXM capability in QEMU"
diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c
index ac919c5..0c3b589 100644
--- a/target-i386/hax-all.c
+++ b/target-i386/hax-all.c
@@ -289,8 +289,7 @@
     if (!vm)
         return NULL;
     memset(vm, 0, sizeof(struct hax_vm));
-
-    ret = hax_host_create_vm(hax, vm_id);
+    ret = hax_host_create_vm(hax, &vm_id);
     if (ret) {
         dprint("Failed to create vm %x\n", ret);
         goto error;
diff --git a/target-i386/hax-darwin.c b/target-i386/hax-darwin.c
index 2b460ce..1522d39 100644
--- a/target-i386/hax-darwin.c
+++ b/target-i386/hax-darwin.c
@@ -150,9 +150,10 @@
     return name;
 }
 
-int hax_host_create_vm(struct hax_state *hax, int vm_id)
+int hax_host_create_vm(struct hax_state *hax, int *vmid)
 {
     int ret;
+    int vm_id = 0;
 
     if (hax_invalid_fd(hax->fd))
         return -EINVAL;
@@ -161,7 +162,7 @@
         return 0;
 
     ret = ioctl(hax->fd, HAX_IOCTL_CREATE_VM, &vm_id);
-
+    *vmid = vm_id;
     return ret;
 }
 
diff --git a/target-i386/hax-i386.h b/target-i386/hax-i386.h
index 27203cf..a5a7e1d 100644
--- a/target-i386/hax-i386.h
+++ b/target-i386/hax-i386.h
@@ -71,7 +71,7 @@
 int hax_capability(struct hax_state *hax, struct hax_capabilityinfo *cap);
 
 /* Common host function */
-int hax_host_create_vm(struct hax_state *hax, int vm_id);
+int hax_host_create_vm(struct hax_state *hax, int *vm_id);
 hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id);
 int hax_host_create_vcpu(hax_fd vm_fd, int vcpuid);
 hax_fd hax_host_open_vcpu(int vmid, int vcpuid);
diff --git a/target-i386/hax-windows.c b/target-i386/hax-windows.c
index 346e5c0..0035d21 100644
--- a/target-i386/hax-windows.c
+++ b/target-i386/hax-windows.c
@@ -228,9 +228,10 @@
     return name;
 }
 
-int hax_host_create_vm(struct hax_state *hax, int vm_id)
+int hax_host_create_vm(struct hax_state *hax, int *vmid)
 {
     int ret;
+    int vm_id = 0;
     DWORD dSize = 0;
 
     if (hax_invalid_fd(hax->fd))
@@ -249,7 +250,7 @@
         dprint("error code:%d", GetLastError());
         return -1;
     }
-
+    *vmid = vm_id;
     return 0;
 }