All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Cc: kvm@vger.kernel.org
Subject: Re: [RFC PATCH] x86 emulator: emulate CPUID instruction
Date: Sun, 21 Dec 2008 14:11:31 +0200	[thread overview]
Message-ID: <494E3273.4050402@redhat.com> (raw)
In-Reply-To: <20081215124355.009afdb5@frecb000711>

Guillaume Thouvenin wrote:
> This patch emulates CPUID instruction. It should work but when I'm
> testing it in kvm-userspace, the cpuid instruction seems to have no
> effect (I mean eax == ebx == ecx == edx == 0x0). Should
> kvm_cpuid_emulate() be modified? Is cpuid instruction correctly
> implemented?
>
>   

It doesn't have any effect because writeback() writes back the cached 
registers back into vcpu->arch.regs, overwriting kvm_cpuid_emulate()'s 
effect.

You need to first modify kvm_cpuid_emulate() to accept the registers as 
in/out parameters, and pass the emulator's registers which can be later 
written back.

An alternative implementation can modify the emulator not to work on a 
temporarary copy, instead something like this:

decode():
   copy registers to backup store

execute():
   start executing
   if fail:
        copy registers from backup store to main state
 
The later approach is more invasive, but has the advantage of speeding 
up the emulator (since usually emulation will succeed, so we don't need 
to writeback)

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


      reply	other threads:[~2008-12-21 12:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 11:43 [RFC PATCH] x86 emulator: emulate CPUID instruction Guillaume Thouvenin
2008-12-21 12:11 ` 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=494E3273.4050402@redhat.com \
    --to=avi@redhat.com \
    --cc=guillaume.thouvenin@ext.bull.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.