Merge branch 'for-2.6.24' of git://git.secretlab.ca/git/linux-2.6-mpc52xx into merge
[linux-2.6] / include / asm-sparc64 / byteorder.h
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
4
5 #include <asm/types.h>
6 #include <asm/asi.h>
7
8 #ifdef __GNUC__
9
10 static __inline__ __u16 ___arch__swab16p(const __u16 *addr)
11 {
12         __u16 ret;
13
14         __asm__ __volatile__ ("lduha [%1] %2, %0"
15                               : "=r" (ret)
16                               : "r" (addr), "i" (ASI_PL));
17         return ret;
18 }
19
20 static __inline__ __u32 ___arch__swab32p(const __u32 *addr)
21 {
22         __u32 ret;
23
24         __asm__ __volatile__ ("lduwa [%1] %2, %0"
25                               : "=r" (ret)
26                               : "r" (addr), "i" (ASI_PL));
27         return ret;
28 }
29
30 static __inline__ __u64 ___arch__swab64p(const __u64 *addr)
31 {
32         __u64 ret;
33
34         __asm__ __volatile__ ("ldxa [%1] %2, %0"
35                               : "=r" (ret)
36                               : "r" (addr), "i" (ASI_PL));
37         return ret;
38 }
39
40 #define __arch__swab16p(x) ___arch__swab16p(x)
41 #define __arch__swab32p(x) ___arch__swab32p(x)
42 #define __arch__swab64p(x) ___arch__swab64p(x)
43
44 #define __BYTEORDER_HAS_U64__
45
46 #endif /* __GNUC__ */
47
48 #include <linux/byteorder/big_endian.h>
49
50 #endif /* _SPARC64_BYTEORDER_H */