public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: James Jacobsson <slowcoder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: Real-mode support. What's needed ?
Date: Mon, 01 Jan 2007 10:12:10 +0200	[thread overview]
Message-ID: <4598C25A.40004@qumranet.com> (raw)
In-Reply-To: <fe247b50612311933x6baaf8c0v24ae6b85be003d68-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

James Jacobsson wrote:
> I've gotten a fair bit on my device emulation code. The linux kernel
> is actually booting all the way to mounting the root FS right now.
>   

Very impressive.  I keep saying how kvm isn't tied to qemu, but I never 
thought someone would go and actually do it.

> Currently I'm working on sorting out some bugs in the ATA irq
> handling, so there's definitely some progress.
> Thanks for your help, Avi and Dor. I wouldn't gotten this far this
> fast without your help.
>
> However, I'm currently "cheating" by loading 32 bit ELF binaries and
> executing them, instead of doing a complete boot sequence starting
> with a BIOS. This will of course stop me dead in the tracks if I
> wanted to launch anything but OSS *NIX systems.
>
> So, my question is:
> What's needed to get the x86_emulate.c code in a better state (the
> TODO page says something needs to be done), and how would I go about
> starting KVM in real-mode?
> Will it do everything right if I just set cr0 to indicate that we're
> not executing in 32bit more?
>   

The vcpu creation ioctl() creates a vcpu just after a reset - that is, 
ready to run the first bios instruction.

You will need to load your bios to physical address 0xf0000, but that's it.

> Will KVM spit out some kind of debug information when it encounters an
> instruction it cannot handle ?
>
>   

It will say 'emulation failed but !something' and the instruction opcodes.


x86_emulate.c does need an overhaul.  It can boot Windows and some 
Linuces but some boot loaders confuse it.

The following needs to be done:
- get rid of the dependency on cr2.  I did most of this work by adding 
mod r/m decoding, however a bit more needs to be done for absolute 
address references.
- add support for reg/reg instructions.  For example, mov reg, mem is 
supported but mov reg, reg is not.
- add support for more instructions - branches, stack operations, etc.

I see that Xen has been doing much the same for their x86_emulate.c, so 
we can probably pick up some of the changes from them.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  parent reply	other threads:[~2007-01-01  8:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-01  3:33 Real-mode support. What's needed ? James Jacobsson
     [not found] ` <fe247b50612311933x6baaf8c0v24ae6b85be003d68-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-01-01  8:12   ` Avi Kivity [this message]
2007-01-01  8:23   ` Dor Laor

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=4598C25A.40004@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=slowcoder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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