[PATCH] x86emul: spilt vex_np from vex_none

Jan Beulich <[email protected]> Thu, 30 Jul 2026 10:48:23 +0200
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
..., undoing the aliasing between two distinct enums, and more in line
with how the SDM nowadays names things.

Signed-off-by: Jan Beulich <[email protected]>
---
This becomes necessary in the APX series (yet to be posted), but I think
it's a good idea to do the split anyway.

--- a/xen/arch/x86/x86_emulate/0f01.c
+++ b/xen/arch/x86/x86_emulate/0f01.c
@@ -34,7 +34,7 @@ int x86emul_0f01(struct x86_emulate_stat
     case 0xc6:
         switch ( s->vex.pfx )
         {
-        case vex_none: /* wrmsrns */
+        case vex_np: /* wrmsrns */
             vcpu_must_have(wrmsrns);
             generate_exception_if(!mode_ring0(), X86_EXC_GP, 0);
             fail_if(!ops->write_msr);
@@ -120,7 +120,7 @@ int x86emul_0f01(struct x86_emulate_stat
     case 0xe8:
         switch ( s->vex.pfx )
         {
-        case vex_none: /* serialize */
+        case vex_np: /* serialize */
             vcpu_must_have(serialize);
             asm volatile ( ".byte 0x0f, 0x01, 0xe8" ); /* Binutils >= 2.34, Clang >= 11 */
             break;
@@ -154,7 +154,7 @@ int x86emul_0f01(struct x86_emulate_stat
     case 0xee:
         switch ( s->vex.pfx )
         {
-        case vex_none: /* rdpkru */
+        case vex_np: /* rdpkru */
             if ( !ops->read_cr ||
                  ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
                 cr4 = 0;
@@ -171,7 +171,7 @@ int x86emul_0f01(struct x86_emulate_stat
     case 0xef:
         switch ( s->vex.pfx )
         {
-        case vex_none: /* wrpkru */
+        case vex_np: /* wrpkru */
             if ( !ops->read_cr ||
                  ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
                 cr4 = 0;
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -1862,7 +1862,7 @@ int x86emul_decode(struct x86_emulate_st
     case simd_packed_int:
         switch ( s->vex.pfx )
         {
-        case vex_none:
+        case vex_np:
             if ( !s->vex.opcx )
             {
                 s->op_bytes = 8;
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -195,10 +195,9 @@ enum simd_opsize {
 };
 typedef uint8_t simd_opsize_t;
 
-#define vex_none 0
-
 enum vex_opcx {
-    vex_0f = vex_none + 1,
+    vex_none,
+    vex_0f,
     vex_0f38,
     vex_0f3a,
     evex_map5 = 5,
@@ -206,7 +205,8 @@ enum vex_opcx {
 };
 
 enum vex_pfx {
-    vex_66 = vex_none + 1,
+    vex_np,
+    vex_66,
     vex_f3,
     vex_f2
 };
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6031,7 +6031,7 @@ x86_emulate(
         pvex = copy_VEX(opc, vex);
         pvex->opcx = vex_0f;
         if ( elem_bytes == 4 )
-            pvex->pfx = vex_none;
+            pvex->pfx = vex_np;
         opc[0] = 0x50; /* vmovmskp{s,d} */
         /* Use %rax as GPR destination and VEX.vvvv as source. */
         pvex->r = 1;