From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO6My-0007t3-I3 for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:07:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UO6Mt-0008Ma-Ng for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:07:52 -0400 Date: Fri, 5 Apr 2013 15:07:43 +0200 From: Stefan Hajnoczi Message-ID: <20130405130743.GF15818@stefanha-thinkpad.redhat.com> References: <1365117183-23730-1-git-send-email-brendandg@gatech.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1365117183-23730-1-git-send-email-brendandg@gatech.edu> Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] target-i386: fix order of checks in cpu_get_phys_page_debug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Brendan Dolan-Gavitt Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org On Thu, Apr 04, 2013 at 07:13:03PM -0400, Brendan Dolan-Gavitt wrote: > In target-i386 cpu_get_phys_page_debug, the CR4_PAE bit is checked > before CR0_PG. This means that if paging is disabled but the PAE bit has > been set in CR4, cpu_get_phys_page_debug will return the wrong result > (it will try to translate the address as virtual rather than using it as > a physical address). This patch fixes that by moving the CR0_PG check to > the beginning of the function. > > This shows up when booting the Linux kernel on amd64 with "-d in_asm". > The kernel turns on the PAE bit in CR4 before turning on paging, and so > QEMU's disassembler will fail because it will try to walk the page > tables to fetch code even though paging is disabled. The symptom is > incorrect disassembly and some "Disassembler disagrees with translator > over instruction decoding" messages. > > This was also reported as bug #1163065. > > Signed-off-by: Brendan Dolan-Gavitt > --- > target-i386/helper.c | 121 ++++++++++++++++++++++++++------------------------ > 1 file changed, 64 insertions(+), 57 deletions(-) Sorry, not trivial :). Stefan