[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86: modernize swab64()



commit 0d87ca02378a56fef83c62fd17f25e10be40b36b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Oct 31 12:40:13 2024 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Oct 31 12:40:13 2024 +0100

    x86: modernize swab64()
    
    For quite a while we didn't need to be concerned of 32-bit code
    generation anymore: Simply use the 64-bit form of BSWAP here.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
---
 xen/arch/x86/include/asm/byteorder.h | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/include/asm/byteorder.h 
b/xen/arch/x86/include/asm/byteorder.h
index a877c07f67..f3330af67e 100644
--- a/xen/arch/x86/include/asm/byteorder.h
+++ b/xen/arch/x86/include/asm/byteorder.h
@@ -10,17 +10,10 @@ static inline attr_const __u32 ___arch__swab32(__u32 x)
     return x;
 }
 
-static inline attr_const __u64 ___arch__swab64(__u64 val)
+static inline attr_const uint64_t ___arch__swab64(uint64_t x)
 { 
-    union { 
-        struct { __u32 a,b; } s;
-        __u64 u;
-    } v;
-    v.u = val;
-    asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 
-        : "=r" (v.s.a), "=r" (v.s.b) 
-        : "0" (v.s.a), "1" (v.s.b)); 
-    return v.u;
+    asm ( "bswap %0" : "+r" (x) );
+    return x;
 } 
 
 /* Do not define swab16.  Gcc is smart enough to recognize "C" version and
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.