1 #ifndef KVM__KVM_ARCH_H 2 #define KVM__KVM_ARCH_H 3 4 #include "kvm/interrupt.h" 5 #include "kvm/segment.h" 6 7 #include <stdbool.h> 8 #include <linux/types.h> 9 #include <time.h> 10 11 #define KVM_NR_CPUS (255) 12 13 /* 14 * The hole includes VESA framebuffer and PCI memory. 15 */ 16 #define KVM_32BIT_GAP_SIZE (768 << 20) 17 #define KVM_32BIT_GAP_START ((1ULL << 32) - KVM_32BIT_GAP_SIZE) 18 19 #define KVM_MMIO_START KVM_32BIT_GAP_START 20 21 struct kvm { 22 int sys_fd; /* For system ioctls(), i.e. /dev/kvm */ 23 int vm_fd; /* For VM ioctls() */ 24 timer_t timerid; /* Posix timer for interrupts */ 25 26 int nrcpus; /* Number of cpus to run */ 27 28 u32 mem_slots; /* for KVM_SET_USER_MEMORY_REGION */ 29 30 u64 ram_size; 31 void *ram_start; 32 33 bool nmi_disabled; 34 35 bool single_step; 36 37 u16 boot_selector; 38 u16 boot_ip; 39 u16 boot_sp; 40 41 struct interrupt_table interrupt_table; 42 43 const char *vmlinux; 44 struct disk_image **disks; 45 int nr_disks; 46 47 const char *name; 48 }; 49 50 static inline void *guest_flat_to_host(struct kvm *kvm, unsigned long offset); /* In kvm.h */ 51 52 static inline void *guest_real_to_host(struct kvm *kvm, u16 selector, u16 offset) 53 { 54 unsigned long flat = segment_to_flat(selector, offset); 55 56 return guest_flat_to_host(kvm, flat); 57 } 58 59 #endif /* KVM__KVM_ARCH_H */ 60