diff mbox series

[for-4.21] x86emul: drop open-coding of REX.W prefixes

Message ID a2f8501d-2cc9-4210-ab33-cd70f47c6373@suse.com (mailing list archive)
State New
Headers show
Series [for-4.21] x86emul: drop open-coding of REX.W prefixes | expand

Commit Message

Jan Beulich Jan. 21, 2025, 4:44 p.m. UTC
Along the lines of 0e3642514719 ("x86: drop REX64_PREFIX"), move to well
formed FXSAVEQ / FXRSTORQ here as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper Jan. 21, 2025, 4:53 p.m. UTC | #1
On 21/01/2025 4:44 pm, Jan Beulich wrote:
> Along the lines of 0e3642514719 ("x86: drop REX64_PREFIX"), move to well
> formed FXSAVEQ / FXRSTORQ here as well.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox series

Patch

--- a/xen/arch/x86/x86_emulate/blk.c
+++ b/xen/arch/x86/x86_emulate/blk.c
@@ -259,16 +259,7 @@  int x86_emul_blk(
         if ( s->op_bytes < sizeof(*fxsr) )
         {
             if ( s->rex_prefix & REX_W )
-            {
-                /*
-                 * The only way to force fxsaveq on a wide range of gas
-                 * versions. On older versions the rex64 prefix works only if
-                 * we force an addressing mode that doesn't require extended
-                 * registers.
-                 */
-                asm volatile ( ".byte 0x48; fxsave (%1)"
-                               : "=m" (*fxsr) : "R" (fxsr) );
-            }
+                asm volatile ( "fxsaveq %0" : "=m" (*fxsr) );
             else
                 asm volatile ( "fxsave %0" : "=m" (*fxsr) );
         }
@@ -285,11 +276,7 @@  int x86_emul_blk(
         generate_exception_if(fxsr->mxcsr & ~mxcsr_mask, X86_EXC_GP, 0);
 
         if ( s->rex_prefix & REX_W )
-        {
-            /* See above for why operand/constraints are this way. */
-            asm volatile ( ".byte 0x48; fxrstor (%1)"
-                           :: "m" (*fxsr), "R" (fxsr) );
-        }
+            asm volatile ( "fxrstorq %0" :: "m" (*fxsr) );
         else
             asm volatile ( "fxrstor %0" :: "m" (*fxsr) );
         break;
@@ -310,11 +297,7 @@  int x86_emul_blk(
             fxsr = ptr;
 
         if ( s->rex_prefix & REX_W )
-        {
-            /* See above for why operand/constraints are this way. */
-            asm volatile ( ".byte 0x48; fxsave (%1)"
-                           : "=m" (*fxsr) : "R" (fxsr) );
-        }
+            asm volatile ( "fxsaveq %0" : "=m" (*fxsr) );
         else
             asm volatile ( "fxsave %0" : "=m" (*fxsr) );