Introduce vm_get_vcpu helper function.
Change-Id: I46aef6d240a74357b96b6677d1ec4c8386076f57
diff --git a/src/api.c b/src/api.c
index 16af2d0..7babccd 100644
--- a/src/api.c
+++ b/src/api.c
@@ -67,7 +67,7 @@
enum vcpu_state secondary_state)
{
struct vm *primary = vm_get(HF_PRIMARY_VM_ID);
- struct vcpu *next = &primary->vcpus[cpu_index(current->cpu)];
+ struct vcpu *next = vm_get_vcpu(primary, cpu_index(current->cpu));
/*
* If the secondary is blocked but has a timer running, sleep until the
@@ -491,7 +491,7 @@
}
/* Update state if allowed. */
- vcpu = &vm->vcpus[vcpu_idx];
+ vcpu = vm_get_vcpu(vm, vcpu_idx);
if (!api_vcpu_prepare_run(current, vcpu, &ret)) {
goto out;
}
@@ -1159,7 +1159,7 @@
return -1;
}
- target_vcpu = &target_vm->vcpus[target_vcpu_idx];
+ target_vcpu = vm_get_vcpu(target_vm, target_vcpu_idx);
dlog("Injecting IRQ %d for VM %d VCPU %d from VM %d VCPU %d\n", intid,
target_vm_id, target_vcpu_idx, current->vm->id, current->cpu->id);