On Wed, May 11, 2011 at 12:05 AM, Sasha Levin <levinsasha...@gmail.com> wrote: > + if (kvm->ram_size < 0xe0000000) {
Please use the ULL postfix for constants to ensure the types are sane. Also, please come up with a sane name for these. > @@ -60,7 +60,14 @@ static inline u32 segment_to_flat(u16 selector, u16 offset) > > static inline void *guest_flat_to_host(struct kvm *self, unsigned long > offset) > { > - return self->ram_start + offset; > + /* > + * We have a gap between 0xe0000000 and 0x100000000. > + * Consider it when translating an address above 0x100000000. > + */ > + if (offset < 0xe0000000) > + return self->ram_start + offset; > + else > + return self->ram_start + 0xe0000000 + (offset - 0x100000000); > } Would it not be simpler to mmap() a "ram_size + gap_size" contiguous region and mprotect(PROT_NONE) the gap? We'd still tell KVM and E820 maps about two separate regions but guest_flat_to_host() would work-as-is. Pekka -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html