Import 2.3.18pre1
[davej-history.git] / include / asm-sparc64 / byteorder.h
blobf8c370d26b3a6e2a9007e97c87aace279c25ed34
1 /* $Id: byteorder.h,v 1.8 1997/12/18 02:44:14 ecd Exp $ */
2 #ifndef _SPARC64_BYTEORDER_H
3 #define _SPARC64_BYTEORDER_H
5 #include <asm/types.h>
6 #include <asm/asi.h>
8 #ifdef __GNUC__
10 static __inline__ __u16 ___arch__swab16p(__u16 *addr)
12 __u16 ret;
14 __asm__ __volatile__ ("lduha [%1] %2, %0"
15 : "=r" (ret)
16 : "r" (addr), "i" (ASI_PL));
17 return ret;
20 static __inline__ __u32 ___arch__swab32p(__u32 *addr)
22 __u32 ret;
24 __asm__ __volatile__ ("lduwa [%1] %2, %0"
25 : "=r" (ret)
26 : "r" (addr), "i" (ASI_PL));
27 return ret;
30 static __inline__ __u64 ___arch__swab64p(__u64 *addr)
32 __u64 ret;
34 __asm__ __volatile__ ("ldxa [%1] %2, %0"
35 : "=r" (ret)
36 : "r" (addr), "i" (ASI_PL));
37 return ret;
40 #define __arch__swab16p(x) ___arch__swab16p(x)
41 #define __arch__swab32p(x) ___arch__swab32p(x)
42 #define __arch__swab64p(x) ___arch__swab64p(x)
44 #define __BYTEORDER_HAS_U64__
46 #endif /* __GNUC__ */
48 #include <linux/byteorder/big_endian.h>
50 #endif /* _SPARC64_BYTEORDER_H */