From: Kyle McMartin <kyle@mcmartin.ca>
To: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Kyle McMartin <kyle@mcmartin.ca>
Subject: [COMPAT] Add compat_merge64 helper
Date: Fri, 28 Sep 2007 18:33:51 -0400 [thread overview]
Message-ID: <1191018832-18069-1-git-send-email-kyle@mcmartin.ca> (raw)
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
next reply other threads:[~2007-09-28 23:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-28 22:33 Kyle McMartin [this message]
2007-09-28 22:33 ` [PATCH] Generic compat_sys_fallocate Kyle McMartin
2007-09-29 9:11 ` Geert Uytterhoeven
2007-09-28 23:38 ` [COMPAT] Add compat_merge64 helper Arnd Bergmann
2007-09-29 0:01 ` Kyle McMartin
2007-09-28 23:52 ` Arnd Bergmann
2007-09-29 0:02 ` Kyle McMartin
2007-09-29 7:23 ` Paul Mundt
2007-09-29 9:48 ` Heiko Carstens
2007-10-03 12:12 ` Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1191018832-18069-1-git-send-email-kyle@mcmartin.ca \
--to=kyle@mcmartin.ca \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®