1 #ifndef _S390_BYTEORDER_H
2 #define _S390_BYTEORDER_H
5 * include/asm-s390/byteorder.h
8 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
12 #include <asm/types.h>
17 static __inline__ __u64 ___arch__swab64p(const __u64 *x)
21 __asm__ __volatile__ (
23 : "=d" (result) : "m" (*x) );
27 static __inline__ __u64 ___arch__swab64(__u64 x)
31 __asm__ __volatile__ (
33 : "=d" (result) : "d" (x) );
37 static __inline__ void ___arch__swab64s(__u64 *x)
39 *x = ___arch__swab64p(x);
41 #endif /* __s390x__ */
43 static __inline__ __u32 ___arch__swab32p(const __u32 *x)
47 __asm__ __volatile__ (
53 : "=&d" (result) : "a" (x), "m" (*x) : "cc" );
56 : "=d" (result) : "m" (*x) );
57 #endif /* __s390x__ */
61 static __inline__ __u32 ___arch__swab32(__u32 x)
64 return ___arch__swab32p(&x);
68 __asm__ __volatile__ (
70 : "=d" (result) : "d" (x) );
72 #endif /* __s390x__ */
75 static __inline__ void ___arch__swab32s(__u32 *x)
77 *x = ___arch__swab32p(x);
80 static __inline__ __u16 ___arch__swab16p(const __u16 *x)
84 __asm__ __volatile__ (
88 : "=&d" (result) : "a" (x), "m" (*x) : "cc" );
91 : "=d" (result) : "m" (*x) );
92 #endif /* __s390x__ */
96 static __inline__ __u16 ___arch__swab16(__u16 x)
98 return ___arch__swab16p(&x);
101 static __inline__ void ___arch__swab16s(__u16 *x)
103 *x = ___arch__swab16p(x);
107 #define __arch__swab64(x) ___arch__swab64(x)
108 #define __arch__swab64p(x) ___arch__swab64p(x)
109 #define __arch__swab64s(x) ___arch__swab64s(x)
110 #endif /* __s390x__ */
111 #define __arch__swab32(x) ___arch__swab32(x)
112 #define __arch__swab16(x) ___arch__swab16(x)
113 #define __arch__swab32p(x) ___arch__swab32p(x)
114 #define __arch__swab16p(x) ___arch__swab16p(x)
115 #define __arch__swab32s(x) ___arch__swab32s(x)
116 #define __arch__swab16s(x) ___arch__swab16s(x)
119 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
120 # define __BYTEORDER_HAS_U64__
121 # define __SWAB_64_THRU_32__
123 #else /* __s390x__ */
124 #define __BYTEORDER_HAS_U64__
125 #endif /* __s390x__ */
127 #endif /* __GNUC__ */
129 #include <linux/byteorder/big_endian.h>
131 #endif /* _S390_BYTEORDER_H */