[COMPAT] Add compat_merge64 helper

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-arch@...>
Cc: <linux-kernel@...>, Kyle McMartin <kyle@...>
Date: Friday, September 28, 2007 - 6:33 pm

To be used when endianness matters for argument ordering when reassembling
a 64-bit value out of two register halves.

Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
---
 include/linux/compat.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 0e69d2c..07bcc3c 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -267,5 +267,14 @@ asmlinkage long compat_sys_signalfd(int ufd,
 asmlinkage long compat_sys_timerfd(int ufd, int clockid, int flags,
 				const struct compat_itimerspec __user *utmr);
 
+static inline u64 compat_merge64(u32 left, u32 right)
+{
+#if defined(__BIG_ENDIAN)
+	return ((u64)left << 32) | right;
+#else /* defined (__LITTLE_ENDIAN) */
+	return ((u64)right << 32) | left;
+#endif
+}
+	
 #endif /* CONFIG_COMPAT */
 #endif /* _LINUX_COMPAT_H */
-- 
1.5.3.2

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[COMPAT] Add compat_merge64 helper, Kyle McMartin, (Fri Sep 28, 6:33 pm)
Re: [COMPAT] Add compat_merge64 helper, Heiko Carstens, (Sat Sep 29, 5:48 am)
Re: [COMPAT] Add compat_merge64 helper, Ralf Baechle, (Wed Oct 3, 8:12 am)
Re: [COMPAT] Add compat_merge64 helper, Arnd Bergmann, (Fri Sep 28, 7:38 pm)
Re: [COMPAT] Add compat_merge64 helper, Kyle McMartin, (Fri Sep 28, 8:01 pm)
Re: [COMPAT] Add compat_merge64 helper, Arnd Bergmann, (Fri Sep 28, 7:52 pm)
Re: [COMPAT] Add compat_merge64 helper, Kyle McMartin, (Fri Sep 28, 8:02 pm)
Re: [COMPAT] Add compat_merge64 helper, Paul Mundt, (Sat Sep 29, 3:23 am)
[PATCH] Generic compat_sys_fallocate, Kyle McMartin, (Fri Sep 28, 6:33 pm)
Re: [PATCH] Generic compat_sys_fallocate, Geert Uytterhoeven, (Sat Sep 29, 5:11 am)