From 20a9fdb4a219e7356b1e9040d52232f28da56783 Mon Sep 17 00:00:00 2001 From: Diego Ongaro Date: Thu, 6 Nov 2008 22:14:16 -0600 Subject: [PATCH] get rid of GET_GUESTVM Either you're operating on the vm (use PROC_GET_GUESTVM), or you're operating on a vcpu (use vcpu->guest_vm). This comes into play other qemu threads want to modify the vm. --- sys/kern/kern_fkvm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_fkvm.c b/sys/kern/kern_fkvm.c index b8921f287f2..db0f68582cf 100644 --- a/sys/kern/kern_fkvm.c +++ b/sys/kern/kern_fkvm.c @@ -119,8 +119,6 @@ struct guestvm { p->p_guestvm = guestvm; \ } while (0) -#define GET_GUESTVM(thread) (TD_GET_VCPU(thread)->guest_vm) - static void print_vmcb_seg(struct vmcb_seg* vmcb_seg, const char* name) { @@ -948,7 +946,7 @@ fkvm_guest_check_range(struct guestvm *guest_vm, uint64_t start, uint64_t end) int fkvm_set_user_mem_region(struct thread *td, struct fkvm_set_user_mem_region_args *uap) { - struct guestvm *guest_vm = GET_GUESTVM(td); + struct guestvm *guest_vm = PROC_GET_GUESTVM(td->td_proc); vm_offset_t start; vm_offset_t end; @@ -1031,7 +1029,7 @@ fkvm_set_user_mem_region(struct thread *td, struct fkvm_set_user_mem_region_args int fkvm_unset_user_mem_region(struct thread *td, struct fkvm_unset_user_mem_region_args *uap) { - struct guestvm *guest_vm = GET_GUESTVM(td); + struct guestvm *guest_vm = PROC_GET_GUESTVM(td->td_proc); vm_offset_t start; vm_offset_t end; @@ -1092,7 +1090,7 @@ fkvm_create_vm(struct thread *td, struct fkvm_create_vm_args *uap) int fkvm_destroy_vm(struct thread *td, struct fkvm_destroy_vm_args *uap) { - struct guestvm *guest_vm = GET_GUESTVM(td); + struct guestvm *guest_vm = PROC_GET_GUESTVM(td->td_proc); /* Destroy the VCPUs */ while (guest_vm->nr_vcpus > 0) { @@ -1114,7 +1112,7 @@ int fkvm_vm_run(struct thread *td, struct fkvm_vm_run_args *uap) { struct vcpu *vcpu = TD_GET_VCPU(td); - struct guestvm *guest_vm = GET_GUESTVM(td); + struct guestvm *guest_vm = vcpu->guest_vm; struct vmcb *vmcb = vcpu->vmcb; int ret = 0; -- 2.11.4.GIT