diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-05-12 23:48:34 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-05-12 23:48:34 +0000 |
commit | 7fd36ebeeec9244a7431bb010e6e3c5e4848a0d5 (patch) | |
tree | 5fb03a9aafdd1cec5f4f6ff7f1873174cb89b66c /include/asm-s390/byteorder.h | |
parent | ba2dacab305c598cd4c34a604f8e276bf5bab5ff (diff) |
Merge with Linux 2.3.99-pre8. Linus must hate me, too man patches ;-)
Diffstat (limited to 'include/asm-s390/byteorder.h')
-rw-r--r-- | include/asm-s390/byteorder.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/include/asm-s390/byteorder.h b/include/asm-s390/byteorder.h new file mode 100644 index 000000000..b2fb3b955 --- /dev/null +++ b/include/asm-s390/byteorder.h @@ -0,0 +1,103 @@ +#ifndef _S390_BYTEORDER_H +#define _S390_BYTEORDER_H + +/* + * include/asm-s390/byteorder.h + * + * S390 version + * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation + * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) + */ + +#include <asm/types.h> + +#ifdef __GNUC__ + +static __inline__ __const__ __u32 ___arch__swab32(__u32 x) +{ + __u32 temp; + + __asm__ __volatile__ ( + " st %0,0(%1)\n" + " icm %0,8,3(%1)\n" + " icm %0,4,2(%1)\n" + " icm %0,2,1(%1)\n" + " ic %0,0(%1)" + : "+&d" (x) : "a" (&temp) : "memory" ); + return x; +} + +static __inline__ __const__ __u32 ___arch__swab32p(__u32 *x) +{ + __u32 result; + + __asm__ __volatile__ ( + " icm %0,8,3(%1)\n" + " icm %0,4,2(%1)\n" + " icm %0,2,1(%1)\n" + " ic %0,0(%1)" + : "=&d" (result) : "a" (x) ); + return result; +} + +static __inline__ void ___arch__swab32s(__u32 *x) +{ + __asm__ __volatile__ ( + " icm 0,8,3(%0)\n" + " icm 0,4,2(%0)\n" + " icm 0,2,1(%0)\n" + " ic 0,0(%0)\n" + " st 0,0(%0)" + : : "a" (x) : "0", "memory"); +} + +static __inline__ __const__ __u16 ___arch__swab16(__u16 x) +{ + __u16 temp; + + __asm__ __volatile__ ( + " sth %0,0(%1)\n" + " icm %0,2,1(%1)\n" + " ic %0,0(%1)\n" + : "+&d" (x) : "a" (&temp) : "memory"); + return x; +} + +static __inline__ __const__ __u16 ___arch__swab16p(__u16 *x) +{ + __u16 result; + + __asm__ __volatile__ ( + " sr %0,%0\n" + " icm %0,2,1(%1)\n" + " ic %0,0(%1)\n" + : "=&d" (result) : "a" (x) ); + return result; +} + +static __inline__ void ___arch__swab16s(__u16 *x) +{ + __asm__ __volatile__( + " icm 0,2,1(%0)\n" + " ic 0,0(%0)\n" + " sth 0,0(%0)" + : : "a" (x) : "0", "memory"); +} + +#define __arch__swab32(x) ___arch__swab32(x) +#define __arch__swab16(x) ___arch__swab16(x) +#define __arch__swab32p(x) ___arch__swab32p(x) +#define __arch__swab16p(x) ___arch__swab16p(x) +#define __arch__swab32s(x) ___arch__swab32s(x) +#define __arch__swab16s(x) ___arch__swab16s(x) + +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ +#endif + +#endif /* __GNUC__ */ + +#include <linux/byteorder/big_endian.h> + +#endif /* _S390_BYTEORDER_H */ |