From: Avi Kivity <avi@redhat.com>
To: Nelson Elhage <nelhage@ksplice.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: emulator: Use linearize() when fetching instructions.
Date: Sun, 17 Apr 2011 15:26:26 +0300 [thread overview]
Message-ID: <4DAADC72.5040503@redhat.com> (raw)
In-Reply-To: <1302838072-16717-1-git-send-email-nelhage@ksplice.com>
On 04/15/2011 06:27 AM, Nelson Elhage wrote:
> This means that the truncation behavior in linearize needs to grow an additional
> slight piece of complexity: when fetching, truncation is dependent on the
> execution mode, instead of the current address size.
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index a5f63d4..d3d43a7 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -542,7 +542,7 @@ static int emulate_nm(struct x86_emulate_ctxt *ctxt)
>
> static int linearize(struct x86_emulate_ctxt *ctxt,
> struct segmented_address addr,
> - unsigned size, bool write,
> + unsigned size, bool write, bool fetch,
Calls to functions with strings of bool arguments are confusing. Please
make this __linearize, and introduce a new linearize() which doesn't
have a fetch argument.
> ulong *linear)
> {
> struct decode_cache *c =&ctxt->decode;
> @@ -602,7 +602,7 @@ static int linearize(struct x86_emulate_ctxt *ctxt,
> }
> break;
> }
linearize() will currently fault on an unreadable code segment. Need to
avoid that on instruction fetches.
> - if (c->ad_bytes != 8)
> + if (fetch ? ctxt->mode != X86EMUL_MODE_PROT64 : c->ad_bytes != 8)
> la&= (u32)-1;
> *linear = la;
> return X86EMUL_CONTINUE;
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-04-17 12:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-13 15:44 [PATCH] KVM: emulator: Handle wraparound in (cs_base + offset) when fetching Nelson Elhage
2011-04-13 16:06 ` Avi Kivity
2011-04-15 3:27 ` [PATCH] KVM: emulator: Use linearize() when fetching instructions Nelson Elhage
2011-04-17 12:26 ` Avi Kivity [this message]
2011-04-17 9:44 ` [PATCH] KVM: emulator: Handle wraparound in (cs_base + offset) when fetching Avi Kivity
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=4DAADC72.5040503@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nelhage@ksplice.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
Powered by JetHome