All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 64bit unaligned access on 32bit kernel
@ 2005-08-30 10:40 Ralf Baechle
  2006-03-06 11:32 ` Atsushi Nemoto
  0 siblings, 1 reply; 20+ messages in thread
From: Ralf Baechle @ 2005-08-30 10:40 UTC (permalink / raw)
  To: Andrew Morton, Atsushi Nemoto; +Cc: linux-mips

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>

diff -u -r1.3 unaligned.h
--- suckage/include/asm-generic/unaligned.h 19 May 2005 12:08:41 -0000
+++ suckage/include/asm-generic/unaligned.h 30 Aug 2005 10:28:23 -0000
@@ -16,9 +16,9 @@
  * The main single-value unaligned transfer routines.
  */
 #define get_unaligned(ptr) \
-	((__typeof__(*(ptr)))__get_unaligned((ptr), sizeof(*(ptr))))
+	__get_unaligned((ptr), sizeof(*(ptr)))
 #define put_unaligned(x,ptr) \
-	__put_unaligned((unsigned long)(x), (ptr), sizeof(*(ptr)))
+	__put_unaligned((__u64)(x), (ptr), sizeof(*(ptr)))
 
 /*
  * This function doesn't actually exist.  The idea is that when
@@ -36,19 +36,19 @@
  * Elemental unaligned loads 
  */
 
-static inline unsigned long __uldq(const __u64 *addr)
+static inline __u64 __uldq(const __u64 *addr)
 {
 	const struct __una_u64 *ptr = (const struct __una_u64 *) addr;
 	return ptr->x;
 }
 
-static inline unsigned long __uldl(const __u32 *addr)
+static inline __u32 __uldl(const __u32 *addr)
 {
 	const struct __una_u32 *ptr = (const struct __una_u32 *) addr;
 	return ptr->x;
 }
 
-static inline unsigned long __uldw(const __u16 *addr)
+static inline __u16 __uldw(const __u16 *addr)
 {
 	const struct __una_u16 *ptr = (const struct __una_u16 *) addr;
 	return ptr->x;
@@ -78,7 +78,7 @@
 
 #define __get_unaligned(ptr, size) ({		\
 	const void *__gu_p = ptr;		\
-	unsigned long val;			\
+	__typeof__(*(ptr)) val;			\
 	switch (size) {				\
 	case 1:					\
 		val = *(const __u8 *)__gu_p;	\

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-02-20 14:00 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-30 10:40 [PATCH] 64bit unaligned access on 32bit kernel Ralf Baechle
2006-03-06 11:32 ` Atsushi Nemoto
2006-03-07  1:05   ` Andrew Morton
2006-03-07  2:03     ` Atsushi Nemoto
2006-03-07 18:09     ` Ralf Baechle
2006-03-08  4:58       ` Atsushi Nemoto
2006-03-08  5:12         ` Andrew Morton
2007-02-14 21:42     ` [PATCH] Optimize generic get_unaligned / put_unaligned implementations Ralf Baechle
2007-02-15  4:39       ` Andrew Morton
2007-02-15  8:35         ` Marcel Holtmann
2007-02-15 14:34         ` Ralf Baechle
2007-02-15 21:53           ` Andrew Morton
2007-02-15 22:18             ` Ralf Baechle
2007-02-15 23:05               ` Jeremy Fitzhardinge
2007-02-15 23:38               ` Andrew Morton
2007-02-16  0:13                 ` Jeremy Fitzhardinge
2007-02-16  0:43                 ` Ralf Baechle
2007-02-16  1:27                   ` Andrew Morton
2007-02-16  1:59                     ` Ralf Baechle
2007-02-20 13:50                     ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.