diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2009-01-06 17:56:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 21:10:27 -0500 |
commit | 13f7877bb5aeb1d5ad01ffbf17a80fb550fa6642 (patch) | |
tree | b119569264084c4d49a2884c2ea72832bff162e6 /arch/s390/include/asm/byteorder.h | |
parent | 156ca2bbf6503a02d7d6829886ce381d572de66e (diff) |
s390: introduce asm/swab.h
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/s390/include/asm/byteorder.h')
-rw-r--r-- | arch/s390/include/asm/byteorder.h | 92 |
1 files changed, 2 insertions, 90 deletions
diff --git a/arch/s390/include/asm/byteorder.h b/arch/s390/include/asm/byteorder.h index 8bcf277c8468..b95a2b2933fb 100644 --- a/arch/s390/include/asm/byteorder.h +++ b/arch/s390/include/asm/byteorder.h | |||
@@ -1,95 +1,7 @@ | |||
1 | #ifndef _S390_BYTEORDER_H | 1 | #ifndef _S390_BYTEORDER_H |
2 | #define _S390_BYTEORDER_H | 2 | #define _S390_BYTEORDER_H |
3 | 3 | ||
4 | /* | 4 | #include <asm/swab.h> |
5 | * include/asm-s390/byteorder.h | 5 | #include <linux/byteorder/big_endian.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 | #define __BIG_ENDIAN | ||
15 | |||
16 | #ifndef __s390x__ | ||
17 | # define __SWAB_64_THRU_32__ | ||
18 | #endif | ||
19 | |||
20 | #ifdef __s390x__ | ||
21 | static inline __u64 __arch_swab64p(const __u64 *x) | ||
22 | { | ||
23 | __u64 result; | ||
24 | |||
25 | asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x)); | ||
26 | return result; | ||
27 | } | ||
28 | #define __arch_swab64p __arch_swab64p | ||
29 | |||
30 | static inline __u64 __arch_swab64(__u64 x) | ||
31 | { | ||
32 | __u64 result; | ||
33 | |||
34 | asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x)); | ||
35 | return result; | ||
36 | } | ||
37 | #define __arch_swab64 __arch_swab64 | ||
38 | |||
39 | static inline void __arch_swab64s(__u64 *x) | ||
40 | { | ||
41 | *x = __arch_swab64p(x); | ||
42 | } | ||
43 | #define __arch_swab64s __arch_swab64s | ||
44 | #endif /* __s390x__ */ | ||
45 | |||
46 | static inline __u32 __arch_swab32p(const __u32 *x) | ||
47 | { | ||
48 | __u32 result; | ||
49 | |||
50 | asm volatile( | ||
51 | #ifndef __s390x__ | ||
52 | " icm %0,8,3(%1)\n" | ||
53 | " icm %0,4,2(%1)\n" | ||
54 | " icm %0,2,1(%1)\n" | ||
55 | " ic %0,0(%1)" | ||
56 | : "=&d" (result) : "a" (x), "m" (*x) : "cc"); | ||
57 | #else /* __s390x__ */ | ||
58 | " lrv %0,%1" | ||
59 | : "=d" (result) : "m" (*x)); | ||
60 | #endif /* __s390x__ */ | ||
61 | return result; | ||
62 | } | ||
63 | #define __arch_swab32p __arch_swab32p | ||
64 | |||
65 | #ifdef __s390x__ | ||
66 | static inline __u32 __arch_swab32(__u32 x) | ||
67 | { | ||
68 | __u32 result; | ||
69 | |||
70 | asm volatile("lrvr %0,%1" : "=d" (result) : "d" (x)); | ||
71 | return result; | ||
72 | } | ||
73 | #define __arch_swab32 __arch_swab32 | ||
74 | #endif /* __s390x__ */ | ||
75 | |||
76 | static inline __u16 __arch_swab16p(const __u16 *x) | ||
77 | { | ||
78 | __u16 result; | ||
79 | |||
80 | asm volatile( | ||
81 | #ifndef __s390x__ | ||
82 | " icm %0,2,1(%1)\n" | ||
83 | " ic %0,0(%1)\n" | ||
84 | : "=&d" (result) : "a" (x), "m" (*x) : "cc"); | ||
85 | #else /* __s390x__ */ | ||
86 | " lrvh %0,%1" | ||
87 | : "=d" (result) : "m" (*x)); | ||
88 | #endif /* __s390x__ */ | ||
89 | return result; | ||
90 | } | ||
91 | #define __arch_swab16p __arch_swab16p | ||
92 | |||
93 | #include <linux/byteorder.h> | ||
94 | 6 | ||
95 | #endif /* _S390_BYTEORDER_H */ | 7 | #endif /* _S390_BYTEORDER_H */ |