From 1d1280d7d347bb9467bfe9c161cba254f9e55d1c Mon Sep 17 00:00:00 2001 From: "Jiang, Yunhong" Date: Thu, 23 Feb 2012 05:21:15 +0800 Subject: Fix the vmid issue in HAX This patch is lost when submit the HAX patchset. Without this patch, only one emulator instance can use HAXM. Change-Id: Ia8e47ea471ae154036bb5721c51d6d099d9aff5f Signed-off-by: Xin, Xiaohui Signed-off-by: Jiang, Yunhong --- target-i386/hax-all.c | 3 +-- target-i386/hax-darwin.c | 5 +++-- target-i386/hax-i386.h | 2 +- target-i386/hax-windows.c | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c index 18d65d0..c8f4cec 100644 --- a/target-i386/hax-all.c +++ b/target-i386/hax-all.c @@ -258,8 +258,7 @@ struct hax_vm *hax_vm_create(struct hax_state *hax) 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 b6d27c3..45c781b 100644 --- a/target-i386/hax-darwin.c +++ b/target-i386/hax-darwin.c @@ -136,9 +136,10 @@ static char *hax_vcpu_devfs_string(int vm_id, int vcpu_id) 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; @@ -147,7 +148,7 @@ int hax_host_create_vm(struct hax_state *hax, int vm_id) 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 e55e584..5ad22ad 100644 --- a/target-i386/hax-i386.h +++ b/target-i386/hax-i386.h @@ -69,7 +69,7 @@ int hax_sync_fpu(CPUState *env, struct fx_layout *fl, int set); int hax_vm_destroy(struct hax_vm *vm); /* 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 683a227..d66ec4a 100644 --- a/target-i386/hax-windows.c +++ b/target-i386/hax-windows.c @@ -198,9 +198,10 @@ static char *hax_vcpu_devfs_string(int vm_id, int vcpu_id) 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)) @@ -219,7 +220,7 @@ int hax_host_create_vm(struct hax_state *hax, int vm_id) dprint("error code:%d", GetLastError()); return -1; } - + *vmid = vm_id; return 0; } -- cgit v1.1