1#ifndef _S390_BYTEORDER_H 2#define _S390_BYTEORDER_H 3 4/* 5 * include/asm-s390/byteorder.h 6 * 7 * S390 version 8 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) 10 */ 11 12#include <asm/types.h> 13 14#ifdef __GNUC__ 15 16static __inline__ __const__ __u64 ___arch__swab64(__u64 x) 17{ 18 __u64 result; 19 20 __asm__ __volatile__ ( 21 " lrvg %0,%1" 22 : "=&d" (result) : "m" (x) ); 23 return result; 24} 25 26static __inline__ __const__ __u64 ___arch__swab64p(__u64 *x) 27{ 28 __u64 result; 29 30 __asm__ __volatile__ ( 31 " lrvg %0,%1" 32 : "=d" (result) : "m" (*x) ); 33 return result; 34} 35 36static __inline__ void ___arch__swab64s(__u64 *x) 37{ 38 __asm__ __volatile__ ( 39 " lrvg 0,%0\n" 40 " stg 0,%0" 41 : "+m" (*x) : : "0"); 42} 43 44static __inline__ __const__ __u32 ___arch__swab32(__u32 x) 45{ 46 __u32 result; 47 48 __asm__ __volatile__ ( 49 " lrv %0,%1" 50 : "=&d" (result) : "m" (x) ); 51 return result; 52} 53 54static __inline__ __const__ __u32 ___arch__swab32p(__u32 *x) 55{ 56 __u32 result; 57 58 __asm__ __volatile__ ( 59 " lrv %0,%1" 60 : "=d" (result) : "m" (*x) ); 61 return result; 62} 63 64static __inline__ void ___arch__swab32s(__u32 *x) 65{ 66 __asm__ __volatile__ ( 67 " lrv 0,%0\n" 68 " st 0,%0" 69 : "+m" (*x) : : "0" ); 70} 71 72static __inline__ __const__ __u16 ___arch__swab16(__u16 x) 73{ 74 __u16 result; 75 76 __asm__ __volatile__ ( 77 " lrvh %0,%1" 78 : "=d" (result) : "m" (x) ); 79 return result; 80} 81 82static __inline__ __const__ __u16 ___arch__swab16p(__u16 *x) 83{ 84 __u16 result; 85 86 __asm__ __volatile__ ( 87 " lrvh %0,%1" 88 : "=d" (result) : "m" (*x) ); 89 return result; 90} 91 92static __inline__ void ___arch__swab16s(__u16 *x) 93{ 94 __asm__ __volatile__ ( 95 " lrvh 0,%0\n" 96 " sth 0,%0" 97 : "+m" (*x) : : "0" ); 98} 99 100#define __arch__swab64(x) ___arch__swab64(x) 101#define __arch__swab32(x) ___arch__swab32(x) 102#define __arch__swab16(x) ___arch__swab16(x) 103#define __arch__swab64p(x) ___arch__swab64p(x) 104#define __arch__swab32p(x) ___arch__swab32p(x) 105#define __arch__swab16p(x) ___arch__swab16p(x) 106#define __arch__swab64s(x) ___arch__swab64s(x) 107#define __arch__swab32s(x) ___arch__swab32s(x) 108#define __arch__swab16s(x) ___arch__swab16s(x) 109 110#define __BYTEORDER_HAS_U64__ 111 112#endif /* __GNUC__ */ 113 114#include <linux/byteorder/big_endian.h> 115 116#endif /* _S390_BYTEORDER_H */ 117