Create a VM using ioctl(KVM_CREATE_VM)

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
Pekka Enberg
2010-03-22 23:12:14 +02:00
committed by Will Deacon
parent e1f3acc598
commit 28fa19c020
+7 -1
View File
@@ -24,7 +24,9 @@ static struct cpu *cpu__new(void)
int main(int argc, char *argv[])
{
struct cpu *cpu;
int fd, ret;
int vmfd;
int ret;
int fd;
fd = open("/dev/kvm", O_RDWR);
if (fd < 0)
@@ -34,6 +36,10 @@ int main(int argc, char *argv[])
if (ret != KVM_API_VERSION)
die("ioctl");
vmfd = ioctl(fd, KVM_CREATE_VM, 0);
if (vmfd < 0)
die("open");
cpu = cpu__new();
cpu__reset(cpu);