]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86emul: convert op_bytes/opc checks in SIMD emulation
authorJan Beulich <jbeulich@suse.com>
Fri, 23 Aug 2024 07:13:07 +0000 (09:13 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Aug 2024 07:13:07 +0000 (09:13 +0200)
Raising #UD for an internal shortcoming of the emulator isn't quite
right. Similarly BUG() is bigger a hammer than needed.

Switch to using EXPECT() instead. This way even for insns not covered by
the test harness fuzzers will have a chance of noticing issues, should
any still exist or new ones be introduced.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index 0a7552de96cf39ae982605ee8a00150782e38ca4..0a6d5a35b1738eb5c2c4a1cbcd31b713da441c67 100644 (file)
@@ -8116,13 +8116,13 @@ x86_emulate(
     }
     else if ( state->simd_size != simd_none )
     {
-        generate_exception_if(!op_bytes, X86_EXC_UD);
         generate_exception_if((vex.opcx && (d & TwoOp) &&
                                (vex.reg != 0xf || (evex_encoded() && !evex.RX))),
                               X86_EXC_UD);
 
-        if ( !opc )
-            BUG();
+        EXPECT(op_bytes);
+        EXPECT(opc);
+
         if ( evex_encoded() )
         {
             opc[insn_bytes - EVEX_PFX_BYTES] = 0xc3;