I need a brown paper bag. When converting sectors to bytes, we need to shift
by 9 ("512"), not 4 ("16")...
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This reverts commit c1a099311e695bfe1caca9a11e294fbd70d3ba11. Interrupt
request windows are for host to guest interrupt injection. Software interrupts
and traps happen 100% in the guest.
This patch enables KVM 'interrupt request window' so that KVM_RUN returns when
we hit an interrupt.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Now that we can execute some instructions, don't stop on first single step but
dump some debugging output instead and continue running.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
It seems that if we attempt to run code at any other location than f000:fff0,
we get an KVM_EXIT_UNKNOWN error. To work around that, hardcode a "reset
vector" at f000:fff0 that jumps to 0000:0x7c000 and load the kernel at the
latter location.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
We start KVM in 16-bit mode so we should set cs:ip to point to the real-mode
boot sector and setup code, not the protected mode kernel that starts at 1M.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Some developers may need to pass specific flags
to compiler, usually due to different include/
directory and etc. So add well known CPPFLAGS
here.
Example:
$ CPPFLAGS="-I/home/include" make
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This patch adds segmentation setup for the guest. It's not perfect yet as we
get KVM_EXIT_UNKNOWN but it's a start nevertheless.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Better inform the user that the host kernel do not
support single-stepping debug.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Move helpers out to separate files.
Mostly borrowed from perf
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
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>
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>
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>