x86/emul: Fix the handling of unimplemented Grp7 instructions
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 5 Sep 2017 08:40:58 +0000 (09:40 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 5 Sep 2017 11:58:47 +0000 (12:58 +0100)
commit4d3f0fde471e7588ce512eaff1abdab209d8cd4b
treed484409299299fea6f6c0e5a77f9f06d4810ee6c
parent6dfb43d6f2cd8ea6274d203ca00ecfc7c565f11a
x86/emul: Fix the handling of unimplemented Grp7 instructions

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.

Consolidate the two switch statements into a single one, using ranges to cover
the instructions with memory operands.

Reported-by: Petre Pircalabu <ppircalabu@bitdefender.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
xen/arch/x86/x86_emulate/x86_emulate.c