public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jim MacArthur <jim@mode7.co.uk>
Cc: kvm@vger.kernel.org
Subject: Re: Starting a VM using /dev/kvm
Date: Wed, 20 Nov 2013 18:28:57 +0100	[thread overview]
Message-ID: <528CF159.10001@redhat.com> (raw)
In-Reply-To: <CAMGYSmF9m-GWVRKugan9mcKB9Md4EXtGVjCZh-iV9d0h-SmOBw@mail.gmail.com>

Il 20/11/2013 00:56, Jim MacArthur ha scritto:
> I haven't been able to find much information on it, but by reading the
> API document and stracing qemu I've put together a small program which
> creates a VM, VCPU, and sets up some memory. All of these ioctls
> return successfully, but trying to run always returns with exit code
> 17 and suberror 1 which so far as I can tell seems to be a problem
> with page tables. I'm on an x86_64 host.
> 
> The question is, how does a new vcpu start up? Will it start in full
> 64-bit mode or 16-bit real mode?

By default it start in 16-bit real mode, with CS=0xf000 and EIP=0xfff0,
but CS.base = 0xffff0000.  However, you can send ioctls to modify
CR0/CR4/EFER and place the VCPU in whatever mode you'd like to have.

> And will I need a full set of
> translation tables to run a single instruction or can I just point it
> at some memory and expect it to run?

Real mode doesn't need page tables of course, and so does 32-bit
protected mode with CR0.PG=0.  However, 64-bit mode only exists with
paging (and PAE) enabled.  So you need page tables to enable 64-bit mode.

Paolo

  reply	other threads:[~2013-11-20 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 23:56 Starting a VM using /dev/kvm Jim MacArthur
2013-11-20 17:28 ` Paolo Bonzini [this message]
2013-11-21  0:39   ` Jim MacArthur
2013-11-21  7:27     ` Gleb Natapov
2013-11-21 23:57       ` Jim MacArthur
2013-11-22  6:56         ` Gleb Natapov

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=528CF159.10001@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jim@mode7.co.uk \
    --cc=kvm@vger.kernel.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