From: Anthony Liguori <anthony@codemonkey.ws>
To: Alexander Graf <alex@csgraf.de>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
Avi Kivity <avi@qumranet.com>,
Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Subject: Re: [PATCH] enable gfxboot on VMX
Date: Mon, 18 Feb 2008 21:37:45 -0600 [thread overview]
Message-ID: <47BA4F09.4060706@codemonkey.ws> (raw)
In-Reply-To: <960FE9EB-B82F-40FF-B8C1-8B053DD7259C@csgraf.de>
Alexander Graf wrote:
> Real mode segments are mere offsets. They get lshifted by 4 (as far as
> I remember) and just added to the offset. SS is on some value here
>
Yes, this is correct.
> 0x0000000000046e60: and $0xffff,%esp
> 0x0000000000046e66: shl $0x4,%eax
> 0x0000000000046e69: add %eax,%esp
> 0x0000000000046e6b: mov $0x8,%ax
> 0x0000000000046e6f: mov %eax,%ss
> 0x0000000000046e71: mov %eax,%es
> 0x0000000000046e73: mov %eax,%fs
> 0x0000000000046e75: mov %eax,%gs
>
> set the segments to the selector we just calculated
>
> [...]
>
> So what could be the problem with this code? It looks slightly hacky,
> but works on most x86 computers (some VIAs choke here too).
>
> After the vmexit on writing cr0, we are in a somewhat undefined state.
> For most of it, we are in protected mode by now. But the segments have
> not been set to something meaningful in protected mode, so they still
> are on their old values.
>
> Unfortunately VMX does a lot of sanity checks, if the virtual machine
> is actually valid and can be entered into, when trying to do so. One
> of these checks is 'CS.RPL == SS.RPL'. The RPL are lowest 2 bits (I am
> not too sure about this, read in the manuals if you really need to
> know) of the selector. We don't have a real selector in this
> transitioning phase though, but instead have real mode offsets in
> them. This means, if CS was on 0x0 and SS on 0x1235, there is no way
> the RPL equals condition can be met.
>
Keep in mind, this is not big real mode. The gfxboot code here was
actually rewritten to not use big real mode so that it worked with Xen.
It works with Xen because Xen uses vm86 mode within the host whereas KVM
uses vm86 mode in the guest's VT context. An alternative approach to
fixing this problem (but in a less hackish way) would be to simply use
the host's vm86 mode instead of vm86 mode within the guest's VT context.
However, this does not fix big real mode. For that, you need to do
proper 16-bit instruction emulation.
Regards,
Anthony Liguori
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-02-19 3:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-15 7:13 [PATCH] enable gfxboot on VMX Alexander Graf
2008-02-15 13:47 ` Avi Kivity
2008-02-15 13:58 ` Alexander Graf
2008-02-16 9:06 ` Avi Kivity
2008-02-16 13:34 ` Alexander Graf
2008-02-17 8:15 ` Avi Kivity
2008-02-18 9:17 ` Guillaume Thouvenin
2008-02-18 9:34 ` Alexander Graf
2008-02-18 9:39 ` Alexander Graf
2008-02-29 14:34 ` catch vmentry failure (was enable gfxboot on VMX) Guillaume Thouvenin
2008-03-02 17:15 ` Avi Kivity
2008-02-19 3:37 ` Anthony Liguori [this message]
2008-02-19 8:26 ` [PATCH] enable gfxboot on VMX Avi Kivity
2008-02-15 14:56 ` Anthony Liguori
2008-02-15 15:13 ` Alexander Graf
2008-02-15 15:46 ` Steffen Winterfeldt
2008-02-18 11:46 ` Andi Kleen
2008-02-18 12:04 ` Alexander Graf
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=47BA4F09.4060706@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=alex@csgraf.de \
--cc=avi@qumranet.com \
--cc=guillaume.thouvenin@ext.bull.net \
--cc=kvm-devel@lists.sourceforge.net \
/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