struct kvm_vcpu *vcpus[])
{
uint64_t vcpu_pages, extra_pg_pages, pages;
- struct kvm_vcpu *vcpu;
struct kvm_vm *vm;
int i;
+ TEST_ASSERT(!nr_vcpus || vcpus, "Must provide vCPU array");
+
/* Force slot0 memory size not small than DEFAULT_GUEST_PHY_PAGES */
if (slot0_mem_pages < DEFAULT_GUEST_PHY_PAGES)
slot0_mem_pages = DEFAULT_GUEST_PHY_PAGES;
vm = __vm_create(mode, pages);
- for (i = 0; i < nr_vcpus; ++i) {
- vcpu = vm_vcpu_add(vm, i, guest_code);
- if (vcpus)
- vcpus[i] = vcpu;
- }
+ for (i = 0; i < nr_vcpus; ++i)
+ vcpus[i] = vm_vcpu_add(vm, i, guest_code);
return vm;
}