Files
kvmtool/include/kvm/kvm.h
T
Pekka Enberg 7fb218bdd0 kvm: Load bzImage real-mode boot sector and setup code
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>
2015-06-01 16:39:38 +01:00

41 lines
997 B
C

#ifndef KVM__KVM_H
#define KVM__KVM_H
#include <linux/kvm.h> /* for struct kvm_regs */
#include <stdbool.h>
#include <stdint.h>
struct kvm {
int sys_fd; /* For system ioctls(), i.e. /dev/kvm */
int vm_fd; /* For VM ioctls() */
int vcpu_fd; /* For VCPU ioctls() */
struct kvm_run *kvm_run;
uint64_t ram_size;
void *ram_start;
uint16_t boot_cs; /* 16-bit code segment selector */
uint16_t boot_ip; /* 16-bit code offset */
struct kvm_regs regs;
struct kvm_sregs sregs;
};
struct kvm *kvm__init(void);
void kvm__enable_singlestep(struct kvm *self);
bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename);
void kvm__reset_vcpu(struct kvm *self);
void kvm__run(struct kvm *self);
void kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count);
/*
* Debugging
*/
void kvm__show_code(struct kvm *self);
void kvm__show_registers(struct kvm *self);
extern const char *kvm_exit_reasons[];
#endif /* KVM__KVM_H */