Initial commit

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Check for KVM_API_VERSION at init

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Add .gitignore file

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Create a VM using ioctl(KVM_CREATE_VM)

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Move KVM fds into 'struct kvm'

This patch introduces a 'struct kvm' and moves the KVM related file descriptors
into it so that we can introduce helper functions more easily.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Check for KVM_CAP_USER_MEMORY

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Clean up KVM initialization

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Initialize KVM some more

This patch adds some more KVM initialization code. Doesn't work yet, though.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Set up TSS address to make vcpu creation work

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Clean up struct kvm file descriptor names

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Mmap the kvm_run structure

Mmap the kvm_run structure and print out ->exit_reason in human-readable form
upon exit to make it more visible what's happening after KVM_RUN ioctl() is
called.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Move CPU emulation code to cpu.c

The kvm.c file is getting bigger so move CPU emulation code to a separate file.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Load kernel image to the VM

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Initial version of kernel image loading

This patch adds support for checking whether the provided kernel image is a
bzImage or not.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Initialize guest memory region properly

Use posix_memalign() to allocate memory for the guest and register the region
to KVM.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Load bzImage to guest RAM

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Update .gitignore to include object files

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Dump registers after KVM_RUN returns

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Initialize RIP before starting to run the guest

Use the return value of load_kernel() to initialize RIP register before
starting the guest with KVM_RUN ioctl().

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Print out constant names for KVM exit reasons

Things are way easier to debug that way.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>