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("lrvg %0,%1" : "=d" (result) : "m" (*x));
25 static inline __u64 ___arch__swab64(__u64 x)
29 asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
33 static inline void ___arch__swab64s(__u64 *x)
35 *x = ___arch__swab64p(x);
37 #endif /* __s390x__ */
39 static inline __u32 ___arch__swab32p(const __u32 *x)
49 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
52 : "=d" (result) : "m" (*x));
53 #endif /* __s390x__ */
57 static inline __u32 ___arch__swab32(__u32 x)
60 return ___arch__swab32p(&x);
64 asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x));
66 #endif /* __s390x__ */
69 static __inline__ void ___arch__swab32s(__u32 *x)
71 *x = ___arch__swab32p(x);
74 static __inline__ __u16 ___arch__swab16p(const __u16 *x)
82 : "=&d" (result) : "a" (x), "m" (*x) : "cc");
85 : "=d" (result) : "m" (*x));
86 #endif /* __s390x__ */
90 static __inline__ __u16 ___arch__swab16(__u16 x)
92 return ___arch__swab16p(&x);
95 static __inline__ void ___arch__swab16s(__u16 *x)
97 *x = ___arch__swab16p(x);
101 #define __arch__swab64(x) ___arch__swab64(x)
102 #define __arch__swab64p(x) ___arch__swab64p(x)
103 #define __arch__swab64s(x) ___arch__swab64s(x)
104 #endif /* __s390x__ */
105 #define __arch__swab32(x) ___arch__swab32(x)
106 #define __arch__swab16(x) ___arch__swab16(x)
107 #define __arch__swab32p(x) ___arch__swab32p(x)
108 #define __arch__swab16p(x) ___arch__swab16p(x)
109 #define __arch__swab32s(x) ___arch__swab32s(x)
110 #define __arch__swab16s(x) ___arch__swab16s(x)
113 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
114 # define __BYTEORDER_HAS_U64__
115 # define __SWAB_64_THRU_32__
117 #else /* __s390x__ */
118 #define __BYTEORDER_HAS_U64__
119 #endif /* __s390x__ */
121 #endif /* __GNUC__ */
123 #include <linux/byteorder/big_endian.h>
125 #endif /* _S390_BYTEORDER_H */