diff --git a/include/kvm/segment.h b/include/kvm/segment.h deleted file mode 100644 index 9387a82..0000000 --- a/include/kvm/segment.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef KVM_SEGMENT_H -#define KVM_SEGMENT_H - -#include - -static inline u32 segment_to_flat(u16 selector, u16 offset) -{ - return ((u32)selector << 4) + (u32) offset; -} - -static inline u16 flat_to_seg16(u32 address) -{ - return address >> 4; -} - -static inline u16 flat_to_off16(u32 address, u32 segment) -{ - return address - (segment << 4); -} - -#endif /* KVM_SEGMENT_H */ diff --git a/x86/bios/e820.c b/x86/bios/e820.c index 890f83a..51576b4 100644 --- a/x86/bios/e820.c +++ b/x86/bios/e820.c @@ -1,10 +1,20 @@ +#include "asm/bios/types.h" #include "kvm/e820.h" -#include "kvm/segment.h" #include "kvm/bios.h" #include +static inline u16 flat_to_seg16(u32 address) +{ + return address >> 4; +} + +static inline u16 flat_to_off16(u32 address, u32 segment) +{ + return address - (segment << 4); +} + static inline void set_fs(u16 seg) { asm volatile("movw %0,%%fs" : : "rm" (seg)); diff --git a/x86/bios/int10.c b/x86/bios/int10.c index 4a3813d..2ea4698 100644 --- a/x86/bios/int10.c +++ b/x86/bios/int10.c @@ -1,4 +1,3 @@ -#include "kvm/segment.h" #include "kvm/bios.h" #include "kvm/vesa.h" diff --git a/x86/include/kvm/kvm-arch.h b/x86/include/kvm/kvm-arch.h index 673bdf1..50b3bfb 100644 --- a/x86/include/kvm/kvm-arch.h +++ b/x86/include/kvm/kvm-arch.h @@ -2,7 +2,6 @@ #define KVM__KVM_ARCH_H #include "kvm/interrupt.h" -#include "kvm/segment.h" #include #include diff --git a/x86/kvm.c b/x86/kvm.c index d285d1d..512ad67 100644 --- a/x86/kvm.c +++ b/x86/kvm.c @@ -201,7 +201,7 @@ void kvm__irq_trigger(struct kvm *kvm, int irq) static inline void *guest_real_to_host(struct kvm *kvm, u16 selector, u16 offset) { - unsigned long flat = segment_to_flat(selector, offset); + unsigned long flat = ((u32)selector << 4) + offset; return guest_flat_to_host(kvm, flat); }