From 003a46cfff308ee0d879dfa89b9a7c65b2a481bf Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 15 Oct 2007 13:57:47 +0200 Subject: x86: unify some more trivial include/asm-x86/ 32/64 variants Scripted unification. Signed-off-by: Thomas Gleixner --- include/asm-x86/unaligned.h | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'include/asm-x86/unaligned.h') diff --git a/include/asm-x86/unaligned.h b/include/asm-x86/unaligned.h index 68067150fbc..913598d4f76 100644 --- a/include/asm-x86/unaligned.h +++ b/include/asm-x86/unaligned.h @@ -1,5 +1,37 @@ -#ifdef CONFIG_X86_32 -# include "unaligned_32.h" -#else -# include "unaligned_64.h" -#endif +#ifndef _ASM_X86_UNALIGNED_H +#define _ASM_X86_UNALIGNED_H + +/* + * The x86 can do unaligned accesses itself. + * + * The strange macros are there to make sure these can't + * be misused in a way that makes them not work on other + * architectures where unaligned accesses aren't as simple. + */ + +/** + * 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) (*(ptr)) + +/** + * 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) ((void)( *(ptr) = (val) )) + +#endif /* _ASM_X86_UNALIGNED_H */ -- cgit v1.2.3