From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Bug in protected mode segments? Date: Thu, 23 Oct 2008 09:21:47 +0200 Message-ID: <4900260B.7060701@redhat.com> References: <48FF6512.5010202@web.de> <48FF6754.5040406@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Mathias Gottschlag , kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from mx2.redhat.com ([66.187.237.31]:41734 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752039AbYJWHVo (ORCPT ); Thu, 23 Oct 2008 03:21:44 -0400 In-Reply-To: <48FF6754.5040406@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: Anthony Liguori wrote: > Mathias Gottschlag wrote: >> >> Grub inits the CPU with no paging and flat segmenting, I now activate >> segments to move the code to 0xE0000000 and later activate paging and >> reset the segments. When I run this code on qemu or on real hardware >> (Athlon XP), everything works well, but on kvm I get several hangs. >> For example I try to write to 0xE00B8000 to write into the VGA >> framebuffer. This addres should now get translated back to 0xB8000 by >> the segment which has the base address 0x20000000, and this >> definately works on real hardware, but on kvm I only notice a hang at >> the instruction which writes at that address (kvm still responds, but >> doesn't update eip anymore, execution stops. > > I looked briefly and there didn't appear to be any explicit checks for > wrap around but I think that it will work correctly since we're always > using at least unsigned long in the host. My suspicion is that we're > somehow getting something wrong with MMIO decoding. Well, unsigned long is 64-bits on a 64-bit host, so the generated address will be 0x1000b8000 instead of 0xb8000. So the problem here is likely to be a missing wraparound, rather than a wraparound. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.