From: Kevin O'Connor Subject: Re: [RFC PATCH v3 0/3] Add segment limit checks to emulator Date: Sun, 25 Jul 2010 14:55:31 -0400 Message-ID: <20100725185531.GA24098@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> <20100725171958.GA22310@morn.localdomain> <4C4C83BE.8070406@redhat.com> 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]:54386 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068Ab0GYSzg (ORCPT ); Sun, 25 Jul 2010 14:55:36 -0400 Received: by vws3 with SMTP id 3so1779662vws.19 for ; Sun, 25 Jul 2010 11:55:35 -0700 (PDT) Content-Disposition: inline In-Reply-To: <4C4C83BE.8070406@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Jul 25, 2010 at 09:34:38PM +0300, Avi Kivity wrote: > On 07/25/2010 08:19 PM, Kevin O'Connor wrote: > >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. > > What happens is kvm enters real mode with cs.limit=0xffff, the > guest #GPs due to segment limit violation, and enters the emulator, > which emulates the far jump correctly. > > So this works, and will continue to work even after we fix limit > checking. It's still cleaner IMO to use normal code segments. Makes sense. I committed the patch that avoids this behavior to SeaBIOS git. -Kevin