From: Richard Henderson <rth@twiddle.net>
To: Pranith Kumar <bobby.prani@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] tcg/i386: 'nop' instruction with 'lock' prefix is illegal
Date: Sun, 14 May 2017 14:12:30 -0700 [thread overview]
Message-ID: <a4f70b68-ec18-4237-79fa-b106bc3e29d0@twiddle.net> (raw)
In-Reply-To: <20170513155816.17294-1-bobby.prani@gmail.com>
On 05/13/2017 08:58 AM, Pranith Kumar wrote:
> The instruction "lock nopl (%rax)" should raise an exception. However,
> we don't do that since we do not check for lock prefix for nop
> instructions. The following patch adds this check and makes the
> behavior similar to hardware.
>
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
> target/i386/translate.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/target/i386/translate.c b/target/i386/translate.c
> index 1d1372fb43..76f4ccd3b4 100644
> --- a/target/i386/translate.c
> +++ b/target/i386/translate.c
> @@ -7881,6 +7881,9 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
> gen_nop_modrm(env, s, modrm);
> break;
> case 0x119: case 0x11c ... 0x11f: /* nop (multi byte) */
> + if (prefixes & PREFIX_LOCK) {
> + goto illegal_op;
> + }
> modrm = cpu_ldub_code(env, s->pc++);
> gen_nop_modrm(env, s, modrm);
> break;
>
Surely you'd also want to make this change for 0x11a and 0x11b. Which would
also simplify that code a bit.
That said, there's *lots* of missing LOCK prefix checks. What brings this one
in particular to your attention?
r~
next prev parent reply other threads:[~2017-05-14 21:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-13 15:58 [Qemu-devel] [PATCH] tcg/i386: 'nop' instruction with 'lock' prefix is illegal Pranith Kumar
2017-05-14 21:12 ` Richard Henderson [this message]
2017-05-15 14:58 ` Pranith Kumar
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=a4f70b68-ec18-4237-79fa-b106bc3e29d0@twiddle.net \
--to=rth@twiddle.net \
--cc=bobby.prani@gmail.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).