patch-2.4.7 linux/include/asm-mips64/unaligned.h

Next file: linux/include/asm-ppc/atomic.h
Previous file: linux/include/asm-mips64/termios.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/include/asm-mips64/unaligned.h linux/include/asm-mips64/unaligned.h
@@ -3,8 +3,8 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1996, 1999, 2000 by Ralf Baechle
- * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
+ * Copyright (C) 1996, 1999, 2000, 2001 by Ralf Baechle
+ * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
  */
 #ifndef _ASM_UNALIGNED_H
 #define _ASM_UNALIGNED_H
@@ -84,8 +84,15 @@
 		: "r" (__val));
 }
 
-/* 
- * The main single-value unaligned transfer routines.
+/*
+ * get_unaligned - get value from possibly mis-aligned location
+ * @ptr: pointer to value
+ *
+ * This macro should be used for accessing values larger in size than 
+ * single bytes at locations that are expected to be improperly aligned, 
+ * e.g. retrieving a u16 value from a location not u16-aligned.
+ *
+ * Note that unaligned accesses can be very expensive on some architectures.
  */
 #define get_unaligned(ptr)						\
 ({									\
@@ -102,7 +109,7 @@
 		__val = __ldl_u((const unsigned int *)(ptr));		\
 		break;							\
 	case 8:								\
-		__val = __ldq_u((const unsigned long long *)(ptr));	\
+		__val = __ldq_u((const unsigned long *)(ptr));		\
 		break;							\
 	default:							\
 		__get_unaligned_bad_length();				\
@@ -112,6 +119,17 @@
 	__val;								\
 })
 
+/*
+ * put_unaligned - put value to a possibly mis-aligned location
+ * @val: value to place
+ * @ptr: pointer to location
+ *
+ * This macro should be used for placing values larger in size than 
+ * single bytes at locations that are expected to be improperly aligned, 
+ * e.g. writing a u16 value to a location not u16-aligned.
+ *
+ * Note that unaligned accesses can be very expensive on some architectures.
+ */
 #define put_unaligned(val,ptr)						\
 do {									\
 	switch (sizeof(*(ptr))) {					\

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)