CS 562: Project 3: VMM basics with KVM

Project Overview

For this project, you will build a small hypervisor using the KVM API. I'm not going to give you much direction here, just a simple specification. You can build the hypervisor using whatever language you like, but you'll want something that has bindings to KVM, e.g. C, C++, Rust, or something which would make it easy to add such bindings. You'll want to start by going through the LWN tutorial on getting started with KVM. If you're going to work on a VM, you'll want to make sure you have KVM installed (including the development headers) and you'll want to make sure that nested virtualization is enabled in your VM manager. For example, VMware calls this option "enable hypervisor applications."

VMM Requirements


You probably are not going to want to hand assemble code for your guest (as in the KVM example linked above). Here is a gcc invocation that might help:

        $> as --32 -o smallkern.o smallkern.S
        $> ld -m elf_i386 -Ttext 0x7c00 --oformat binary -o smallkern smallkern.o
This will compile and link your x86 assembly into a flat binary (not ELF). This assumes that the code will be loaded at address 0x7c00, but you will obviously want to change this. It's not hard to extend this to work with C code, but you'll want to use the compiler flags -ffreestanding, -nostdlib, and -m32.

Next steps

If you've gotten this far and you're looking to make your VMM/guest more interesting, here are some tips:


You will hand in your code to me by sending me your code in tarball form (email is fine). You must include a Makefile and a README which describes how to build and run a VM in your hypervisor.