From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: ppircalabu@bitdefender.com, xen-devel@lists.xen.org
Subject: Re: [PATCH RFC v2] x86/emul: Fix the handling of unimplemented Grp7 instructions
Date: Tue, 5 Sep 2017 08:34:04 +0100 [thread overview]
Message-ID: <36c24e93-569c-4d01-eba6-c7dc8df687cf@citrix.com> (raw)
In-Reply-To: <59AE4AF50200007800105948@prv-mh.provo.novell.com>
On 05/09/2017 07:57, Jan Beulich wrote:
>>>> Andrew Cooper <andrew.cooper3@citrix.com> 09/04/17 7:35 PM >>>
>> Grp7 is abnormally complicated to decode, even by x86's standards, with
>> {s,l}msw being the problematic cases.
>>
>> Previously, any value which fell through the first switch statement (looking
>> for instructions with entirely implicit operands) would be interpreted by the
>> second switch statement (handling instructions with memory operands).
>>
>> Unimplemented instructions would then hit the #UD case for having a non-memory
>> operand, rather than taking the cannot_emulate path.
>>
>> Place a big if/else around the two switch statements (accounting for {s,l}msw
>> which need handling in the else clause), so both switch statments can have a
>> default goto cannot_emulate path.
>>
>> This fixes the emulation of xend, which would hit the #UD path when it should
>> complete with no side effects.
> This could be had with a single line change. And while I can see this mistake
> of mine alone to be justification for the restructuring, it's still rather big a change
> due to all the re-indentation. Did you instead consider simply combining the
> two switch() statements (retaining present indentation), by using range case
> labels for the opcodes permitting operands?
That was my first idea, but the cases are not adjacent. You need 3
ranges for the mod != 11 instructions, and 4 for {s,l}msw, and there was
no clean way I could find to express that.
> That would have the added benefit
> of no longer producing #UD for things like VMCALL, but instead having those
> go to cannot_emulate too.
This is the behaviour the patch is intended to introduce. What's broken
with the logic?
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-05 7:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 17:21 [PATCH RFC] x86/emul: Fix the handling of unimplemented Grp7 instructions Andrew Cooper
2017-09-04 17:34 ` [PATCH RFC v2] " Andrew Cooper
2017-09-05 6:57 ` Jan Beulich
2017-09-05 7:34 ` Andrew Cooper [this message]
2017-09-05 9:43 ` Jan Beulich
2017-09-05 9:53 ` Andrew Cooper
2017-09-05 10:07 ` Jan Beulich
2017-09-05 8:41 ` [PATCH v3] " Andrew Cooper
2017-09-05 10:23 ` Jan Beulich
2017-09-05 17:02 ` Petre Ovidiu PIRCALABU
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=36c24e93-569c-4d01-eba6-c7dc8df687cf@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=ppircalabu@bitdefender.com \
--cc=xen-devel@lists.xen.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).