aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-09-06 18:17:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:36 -0400
commiteed74dfcd48101d259012ac08d29061eea500249 (patch)
tree4796e0c960a45c6e6fefbd4452c73122ef3ce12d /include
parent82a25b5670eef736a20613f8b93fe55ecb5ca4bc (diff)
[PATCH] optimise 64bit unaligned access on 32bit kernel
I've rewriten Atushi's fix for the 64-bit put_unaligned on 32-bit systems bug to generate more efficient code. This case has buzilla URL http://bugzilla.kernel.org/show_bug.cgi?id=5138. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/unaligned.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 6c90f0f36eec..4dc8ddb401c1 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -16,9 +16,9 @@
16 * The main single-value unaligned transfer routines. 16 * The main single-value unaligned transfer routines.
17 */ 17 */
18#define get_unaligned(ptr) \ 18#define get_unaligned(ptr) \
19 ((__typeof__(*(ptr)))__get_unaligned((ptr), sizeof(*(ptr)))) 19 __get_unaligned((ptr), sizeof(*(ptr)))
20#define put_unaligned(x,ptr) \ 20#define put_unaligned(x,ptr) \
21 __put_unaligned((unsigned long)(x), (ptr), sizeof(*(ptr))) 21 __put_unaligned((__u64)(x), (ptr), sizeof(*(ptr)))
22 22
23/* 23/*
24 * This function doesn't actually exist. The idea is that when 24 * This function doesn't actually exist. The idea is that when
@@ -36,19 +36,19 @@ struct __una_u16 { __u16 x __attribute__((packed)); };
36 * Elemental unaligned loads 36 * Elemental unaligned loads
37 */ 37 */
38 38
39static inline unsigned long __uldq(const __u64 *addr) 39static inline __u64 __uldq(const __u64 *addr)
40{ 40{
41 const struct __una_u64 *ptr = (const struct __una_u64 *) addr; 41 const struct __una_u64 *ptr = (const struct __una_u64 *) addr;
42 return ptr->x; 42 return ptr->x;
43} 43}
44 44
45static inline unsigned long __uldl(const __u32 *addr) 45static inline __u32 __uldl(const __u32 *addr)
46{ 46{
47 const struct __una_u32 *ptr = (const struct __una_u32 *) addr; 47 const struct __una_u32 *ptr = (const struct __una_u32 *) addr;
48 return ptr->x; 48 return ptr->x;
49} 49}
50 50
51static inline unsigned long __uldw(const __u16 *addr) 51static inline __u16 __uldw(const __u16 *addr)
52{ 52{
53 const struct __una_u16 *ptr = (const struct __una_u16 *) addr; 53 const struct __una_u16 *ptr = (const struct __una_u16 *) addr;
54 return ptr->x; 54 return ptr->x;
@@ -78,7 +78,7 @@ static inline void __ustw(__u16 val, __u16 *addr)
78 78
79#define __get_unaligned(ptr, size) ({ \ 79#define __get_unaligned(ptr, size) ({ \
80 const void *__gu_p = ptr; \ 80 const void *__gu_p = ptr; \
81 unsigned long val; \ 81 __typeof__(*(ptr)) val; \
82 switch (size) { \ 82 switch (size) { \
83 case 1: \ 83 case 1: \
84 val = *(const __u8 *)__gu_p; \ 84 val = *(const __u8 *)__gu_p; \