qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Andy Walls <awalls@md.metrocast.net>
Cc: qemu-devel@nongnu.org, kvm-devel <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] qemu-kvm problem with DOS/4GW extender and EMM386.EXE
Date: Wed, 12 May 2010 00:21:08 +0300	[thread overview]
Message-ID: <4BE9CA44.3080601@redhat.com> (raw)
In-Reply-To: <1273611384.4840.29.camel@localhost>

On 05/11/2010 11:56 PM, Andy Walls wrote:
> Running an MS-DOS 6.22 image with qemu-kvm on a RedHat Linux OS, I
> noticed the guest OS becomes hung and my dmesg gets spammed with
>
> 	set_cr0: #GP, set PG flag with a clear PE flag
>
> That message appears to be the linux kernel's kvm emulator griping about
> Paging Enable bit being enabled while the Protection Enable bit is set
> for real mode.  (The Intel manual says this should be a protection
> fault).
>
> The program that causes this has the DOS/4GW DOS extender runtime
> compiled into it.
>
> I found that when I don't load the EMM386.EXE memory manager, the
> problem doesn't occur.
>
> Here's a kvmtrace segment of when things are not working:
>
>    

Please post kvm issues to kvm@vger.

> 0 (+           0)  CR_READ       vcpu = 0x00000000  pid = 0x00001997 [ CR# = 0, value = 0x00000000 80000011 ]
> 28471049900815 (+        4000)  VMENTRY       vcpu = 0x00000000  pid = 0x00001997
> 28471049903815 (+        3000)  VMEXIT        vcpu = 0x00000000  pid = 0x00001997 [ exitcode = 0x00000010, rip = 0x00000000 00002a73 ]
> 0 (+           0)  LMSW          vcpu = 0x00000000  pid = 0x00001997 [ value = 0x80000010 ]
> 28471049933815 (+       30000)  VMENTRY       vcpu = 0x00000000  pid = 0x00001997
> 28471049936815 (+        3000)  VMEXIT        vcpu = 0x00000000  pid = 0x00001997 [ exitcode = 0x0000007b, rip = 0x00000000 00001fd6 ]
>
>
>
>
> To me it appears EMM386.EXE enables paging, and the DOS/4GW DOS extender
> tries to manipulate the PE bit in CR0 with LMSW but doesn't succeed.
>
> These programs appear to work fine in VMWare and on real hardware.
>
>
> Any ideas on how to make EMM386.EXE and the DOS/$GW extender work in
> qemu-kvm?
>    

Looks like a bug in the implementation of LMSW.  The manual says:

> If the PE flag of the source operand (bit 0) is set to 1, the 
> instruction causes the
> processor to switch to protected mode. While in protected mode, the 
> LMSW instruc-
> tion cannot be used to clear the PE flag and force a switch back to 
> real-address mode.

But kvm doesn't implement that.  Instead, it follows the operation section:

> Operation
> CR0[0:3] ← SRC[0:3];

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

      parent reply	other threads:[~2010-05-11 21:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11 20:56 [Qemu-devel] qemu-kvm problem with DOS/4GW extender and EMM386.EXE Andy Walls
2010-05-11 21:09 ` Mohammed Gamal
2010-05-11 22:10   ` Andy Walls
2010-05-11 21:21 ` Avi Kivity [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BE9CA44.3080601@redhat.com \
    --to=avi@redhat.com \
    --cc=awalls@md.metrocast.net \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).