From: Kevin O'Connor Subject: Re: [RFC PATCH v3 0/3] Add segment limit checks to emulator Date: Sun, 25 Jul 2010 13:19:58 -0400 Message-ID: <20100725171958.GA22310@morn.localdomain> References: <1278888970-2936-1-git-send-email-m.gamal005@gmail.com> <4C3AB59B.60705@redhat.com> <4C3B14E2.8050404@redhat.com> <20100724154522.GA13246@morn.localdomain> <20100724161630.GA15361@morn.localdomain> <4C4BFC13.8080907@redhat.com> <20100725164246.GB18995@morn.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Mohammed Gamal , kvm@vger.kernel.org, seabios@seabios.org To: Avi Kivity Return-path: Received: from mail-vw0-f46.google.com ([209.85.212.46]:49273 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751105Ab0GYRUC (ORCPT ); Sun, 25 Jul 2010 13:20:02 -0400 Received: by vws3 with SMTP id 3so1747413vws.19 for ; Sun, 25 Jul 2010 10:20:01 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20100725164246.GB18995@morn.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Jul 25, 2010 at 12:42:46PM -0400, Kevin O'Connor wrote: > On Sun, Jul 25, 2010 at 11:55:47AM +0300, Avi Kivity wrote: > > What conditions are needed to trigger this path? This can't occur > > under normal operation, since it will fail badly with kvm on Intel. > > It's called on every boot. I've personally only tested kvm on amd, > but I'd have to assume something must be allowing this to work on > intel. BTW, the transition16big code does: ljmpl $SEG32_MODE16BIG_CS, $(0xf0000 + 1f) .code16gcc 1: // Disable protected mode movl %cr0, %eax andl $~CR0_PE, %eax movl %eax, %cr0 // far jump to flush CPU queue after transition to real mode ljmpw $0xf000, $2f 2: Only the ljmpw is in big real mode with a code address >64K - the "Disable protected mode" code is technically in 16bit protected mode. I'm not sure if that helps explain why it works. -Kevin