MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_create

Function vm_create

freebsd/amd64/vmm/vmm.c:470–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468u_int threads_per_core = 1;
469
470int
471vm_create(const char *name, struct vm **retvm)
472{
473 struct vm *vm;
474 struct vmspace *vmspace;
475
476 /*
477 * If vmm.ko could not be successfully initialized then don't attempt
478 * to create the virtual machine.
479 */
480 if (!vmm_initialized)
481 return (ENXIO);
482
483 if (name == NULL || strlen(name) >= VM_MAX_NAMELEN)
484 return (EINVAL);
485
486 vmspace = vmmops_vmspace_alloc(0, VM_MAXUSER_ADDRESS_LA48);
487 if (vmspace == NULL)
488 return (ENOMEM);
489
490 vm = malloc(sizeof(struct vm), M_VM, M_WAITOK | M_ZERO);
491 strcpy(vm->name, name);
492 vm->vmspace = vmspace;
493 mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF);
494
495 vm->sockets = 1;
496 vm->cores = cores_per_package; /* XXX backwards compatibility */
497 vm->threads = threads_per_core; /* XXX backwards compatibility */
498 vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */
499
500 vm_init(vm, true);
501
502 *retvm = vm;
503 return (0);
504}
505
506void
507vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores,

Callers 1

sysctl_vmm_createFunction · 0.85

Calls 3

mallocFunction · 0.85
mtx_initFunction · 0.85
vm_initFunction · 0.85

Tested by

no test coverage detected