From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCHv2 4/5] KVM: emulator: move linearize() out of emulator code.
Date: Sun, 24 Jun 2012 16:39:22 +0300 [thread overview]
Message-ID: <4FE7188A.2080500@redhat.com> (raw)
In-Reply-To: <20120624132710.GW6533@redhat.com>
On 06/24/2012 04:27 PM, Gleb Natapov wrote:
> On Sun, Jun 24, 2012 at 04:12:05PM +0300, Avi Kivity wrote:
>> On 06/12/2012 03:01 PM, Gleb Natapov wrote:
>> > The function will be used outside of the emulator.
>> >
>> > /*
>> > * x86_emulate_ops:
>> > *
>> > @@ -194,6 +199,10 @@ struct x86_emulate_ops {
>> >
>> > bool (*get_cpuid)(struct x86_emulate_ctxt *ctxt,
>> > u32 *eax, u32 *ebx, u32 *ecx, u32 *edx);
>> > +
>> > + int (*linearize)(struct x86_emulate_ctxt *ctxt,
>> > + struct segmented_address addr, unsigned size,
>> > + bool write, bool fetch, ulong *linear);
>> > };
>> >
>>
>> linearize is defined in terms of the other ops; this means that if we
>> get a second user they will have to replicate it.
>>
> What do you mean? This patch series adds another user, so now there are two: one
> inside the emulator another is outside.
I meant like task switching or real-mode interrupt emulation.
>
>> Why not make the current linearize available to users?
>>
> Code outside of the emulator does not call the emulator except when
> emulation is actually needed. To call linearize() from the emulator.c
> almost fully functional emulation ctxt will have to be set up (including
> fake instruction decoding, hacky and slower).
ctxt->d use should be removed for the exported version and replaced by a
parameter. The internal version can still use it (calling the exported
version after extracting the parameter).
To not duplicate the logic
> I moved linearize() to generic code and made it available to emulator
> via callback. It actually saves a couple of callback invocations when
> emulator calls linearize() IIRC.
It's not available to other emulator users (which don't exist yet
anyway). But having linearize() in the emulator is consistent with
placing logic in emulate.c and accessors outside.
Regarding initialization, we should eventually initialize nothing and
let the emulator bring in needed data via callbacks (including general
registers).
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-06-24 13:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 12:01 [PATCHv2 0/5] improve speed of "rep ins" emulation Gleb Natapov
2012-06-12 12:01 ` [PATCHv2 1/5] Provide userspace IO exit completion callback Gleb Natapov
2012-06-29 0:51 ` Marcelo Tosatti
2012-07-01 8:15 ` Gleb Natapov
2012-06-12 12:01 ` [PATCHv2 2/5] KVM: emulator: make x86 emulation modes enum instead of defines Gleb Natapov
2012-06-12 12:01 ` [PATCHv2 3/5] KVM: emulator: move some address manipulation function out of emulator code Gleb Natapov
2012-06-12 12:01 ` [PATCHv2 4/5] KVM: emulator: move linearize() " Gleb Natapov
2012-06-24 13:12 ` Avi Kivity
2012-06-24 13:27 ` Gleb Natapov
2012-06-24 13:39 ` Avi Kivity [this message]
2012-06-24 14:27 ` Gleb Natapov
2012-06-25 12:57 ` Avi Kivity
2012-06-25 13:12 ` Gleb Natapov
2012-06-25 13:40 ` Avi Kivity
2012-06-25 14:17 ` Gleb Natapov
2012-06-25 14:32 ` Avi Kivity
2012-06-25 14:55 ` Gleb Natapov
2012-06-25 15:03 ` Avi Kivity
2012-06-25 15:35 ` Gleb Natapov
2012-06-25 15:50 ` Avi Kivity
2012-06-26 8:30 ` Gleb Natapov
2012-06-26 9:19 ` Avi Kivity
2012-06-12 12:01 ` [PATCHv2 5/5] KVM: Provide fast path for "rep ins" emulation if possible Gleb Natapov
2012-06-29 22:26 ` Marcelo Tosatti
2012-07-01 11:24 ` 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=4FE7188A.2080500@redhat.com \
--to=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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).