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

[Xen-changelog] [linux-2.6.18-xen] linux/x86: avoid casting hypercall return value



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201607613 0
# Node ID e32fe4703ab68245dedcf32d76510623ba86953a
# Parent  2db30156cb5b4450c535ddf5d7f099c0de633e5c
linux/x86: avoid casting hypercall return value

.., being a little more type correct and producing better code on
64-bits.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 include/asm-i386/mach-xen/asm/hypercall.h   |   29 ++++++++++++++++------------
 include/asm-x86_64/mach-xen/asm/hypercall.h |   29 ++++++++++++++++------------
 2 files changed, 34 insertions(+), 24 deletions(-)

diff -r 2db30156cb5b -r e32fe4703ab6 include/asm-i386/mach-xen/asm/hypercall.h
--- a/include/asm-i386/mach-xen/asm/hypercall.h Tue Jan 29 11:53:10 2008 +0000
+++ b/include/asm-i386/mach-xen/asm/hypercall.h Tue Jan 29 11:53:33 2008 +0000
@@ -52,40 +52,43 @@
 
 #define _hypercall0(type, name)                        \
 ({                                             \
-       long __res;                             \
+       type __res;                             \
        asm volatile (                          \
                HYPERCALL_STR(name)             \
                : "=a" (__res)                  \
                :                               \
                : "memory" );                   \
-       (type)__res;                            \
+       __res;                                  \
 })
 
 #define _hypercall1(type, name, a1)                            \
 ({                                                             \
-       long __res, __ign1;                                     \
+       type __res;                                             \
+       long __ign1;                                            \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1)                   \
                : "1" ((long)(a1))                              \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall2(type, name, a1, a2)                                \
 ({                                                             \
-       long __res, __ign1, __ign2;                             \
+       type __res;                                             \
+       long __ign1, __ign2;                                    \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2)    \
                : "1" ((long)(a1)), "2" ((long)(a2))            \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall3(type, name, a1, a2, a3)                    \
 ({                                                             \
-       long __res, __ign1, __ign2, __ign3;                     \
+       type __res;                                             \
+       long __ign1, __ign2, __ign3;                            \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
@@ -93,12 +96,13 @@
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
                "3" ((long)(a3))                                \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall4(type, name, a1, a2, a3, a4)                        \
 ({                                                             \
-       long __res, __ign1, __ign2, __ign3, __ign4;             \
+       type __res;                                             \
+       long __ign1, __ign2, __ign3, __ign4;                    \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
@@ -106,12 +110,13 @@
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
                "3" ((long)(a3)), "4" ((long)(a4))              \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall5(type, name, a1, a2, a3, a4, a5)            \
 ({                                                             \
-       long __res, __ign1, __ign2, __ign3, __ign4, __ign5;     \
+       type __res;                                             \
+       long __ign1, __ign2, __ign3, __ign4, __ign5;            \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
@@ -120,7 +125,7 @@
                "3" ((long)(a3)), "4" ((long)(a4)),             \
                "5" ((long)(a5))                                \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 static inline int __must_check
diff -r 2db30156cb5b -r e32fe4703ab6 include/asm-x86_64/mach-xen/asm/hypercall.h
--- a/include/asm-x86_64/mach-xen/asm/hypercall.h       Tue Jan 29 11:53:10 
2008 +0000
+++ b/include/asm-x86_64/mach-xen/asm/hypercall.h       Tue Jan 29 11:53:33 
2008 +0000
@@ -56,40 +56,43 @@
 
 #define _hypercall0(type, name)                        \
 ({                                             \
-       long __res;                             \
+       type __res;                             \
        asm volatile (                          \
                HYPERCALL_STR(name)             \
                : "=a" (__res)                  \
                :                               \
                : "memory" );                   \
-       (type)__res;                            \
+       __res;                                  \
 })
 
 #define _hypercall1(type, name, a1)                            \
 ({                                                             \
-       long __res, __ign1;                                     \
+       type __res;                                             \
+       long __ign1;                                            \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1)                   \
                : "1" ((long)(a1))                              \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall2(type, name, a1, a2)                                \
 ({                                                             \
-       long __res, __ign1, __ign2;                             \
+       type __res;                                             \
+       long __ign1, __ign2;                                    \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1), "=S" (__ign2)    \
                : "1" ((long)(a1)), "2" ((long)(a2))            \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall3(type, name, a1, a2, a3)                    \
 ({                                                             \
-       long __res, __ign1, __ign2, __ign3;                     \
+       type __res;                                             \
+       long __ign1, __ign2, __ign3;                            \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1), "=S" (__ign2),   \
@@ -97,12 +100,13 @@
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
                "3" ((long)(a3))                                \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall4(type, name, a1, a2, a3, a4)                        \
 ({                                                             \
-       long __res, __ign1, __ign2, __ign3;                     \
+       type __res;                                             \
+       long __ign1, __ign2, __ign3;                            \
        register long __arg4 asm("r10") = (long)(a4);           \
        asm volatile (                                          \
                HYPERCALL_STR(name)                             \
@@ -111,12 +115,13 @@
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
                  "3" ((long)(a3))                              \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 #define _hypercall5(type, name, a1, a2, a3, a4, a5)            \
 ({                                                             \
-       long __res, __ign1, __ign2, __ign3;                     \
+       type __res;                                             \
+       long __ign1, __ign2, __ign3;                            \
        register long __arg4 asm("r10") = (long)(a4);           \
        register long __arg5 asm("r8") = (long)(a5);            \
        asm volatile (                                          \
@@ -126,7 +131,7 @@
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
                  "3" ((long)(a3))                              \
                : "memory" );                                   \
-       (type)__res;                                            \
+       __res;                                                  \
 })
 
 static inline int __must_check

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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