From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, luto@amacapital.net, hpa@zytor.com,
mingo@kernel.org, tglx@linutronix.de
Subject: [tip:x86/vdso] x86/vdso: Add PUT_LE to store little-endian values
Date: Thu, 12 Jun 2014 19:28:10 -0700 [thread overview]
Message-ID: <tip-b4b31f6101433e4b8ee73779b69b935af07682f8@git.kernel.org> (raw)
In-Reply-To: <3d9b27e92745b27b6fda1b9a98f70dc9c1246c7a.1402620737.git.luto@amacapital.net>
Commit-ID: b4b31f6101433e4b8ee73779b69b935af07682f8
Gitweb: http://git.kernel.org/tip/b4b31f6101433e4b8ee73779b69b935af07682f8
Author: Andy Lutomirski <luto@amacapital.net>
AuthorDate: Thu, 12 Jun 2014 17:53:11 -0700
Committer: H. Peter Anvin <hpa@zytor.com>
CommitDate: Thu, 12 Jun 2014 19:01:51 -0700
x86/vdso: Add PUT_LE to store little-endian values
Add PUT_LE() by analogy with GET_LE() to write littleendian values in
addition to reading them.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/3d9b27e92745b27b6fda1b9a98f70dc9c1246c7a.1402620737.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
arch/x86/vdso/vdso2c.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c
index 450ac6e..7a6bf50 100644
--- a/arch/x86/vdso/vdso2c.c
+++ b/arch/x86/vdso/vdso2c.c
@@ -54,7 +54,7 @@ static void fail(const char *format, ...)
}
/*
- * Evil macros to do a little-endian read.
+ * Evil macros for little-endian reads and writes
*/
#define GLE(x, bits, ifnot) \
__builtin_choose_expr( \
@@ -62,11 +62,24 @@ static void fail(const char *format, ...)
(__typeof__(*(x)))get_unaligned_le##bits(x), ifnot)
extern void bad_get_le(void);
-#define LAST_LE(x) \
+#define LAST_GLE(x) \
__builtin_choose_expr(sizeof(*(x)) == 1, *(x), bad_get_le())
#define GET_LE(x) \
- GLE(x, 64, GLE(x, 32, GLE(x, 16, LAST_LE(x))))
+ GLE(x, 64, GLE(x, 32, GLE(x, 16, LAST_GLE(x))))
+
+#define PLE(x, val, bits, ifnot) \
+ __builtin_choose_expr( \
+ (sizeof(*(x)) == bits/8), \
+ put_unaligned_le##bits((val), (x)), ifnot)
+
+extern void bad_put_le(void);
+#define LAST_PLE(x, val) \
+ __builtin_choose_expr(sizeof(*(x)) == 1, *(x) = (val), bad_put_le())
+
+#define PUT_LE(x, val) \
+ PLE(x, val, 64, PLE(x, val, 32, PLE(x, val, 16, LAST_PLE(x, val))))
+
#define NSYMS (sizeof(required_syms) / sizeof(required_syms[0]))
next prev parent reply other threads:[~2014-06-13 2:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 0:53 [PATCH v3 0/4] vDSO reference parser updates and Go workaround Andy Lutomirski
2014-06-13 0:53 ` [PATCH v3 1/4] doc,vdso: Rename vdso_test.c to vdso_standalone_test_x86.c Andy Lutomirski
2014-06-13 2:27 ` [tip:x86/vdso] x86/vdso/doc: " tip-bot for Andy Lutomirski
2014-06-13 0:53 ` [PATCH v3 2/4] doc,vdso: Make vDSO examples more portable Andy Lutomirski
2014-06-13 2:27 ` [tip:x86/vdso] x86/vdso/doc: " tip-bot for Andy Lutomirski
2014-06-13 0:53 ` [PATCH v3 3/4] x86,vdso: Add PUT_LE to store little-endian values Andy Lutomirski
2014-06-13 2:28 ` tip-bot for Andy Lutomirski [this message]
2014-06-13 0:53 ` [PATCH v3 4/4] x86,vdso: Hack to keep 64-bit Go programs working Andy Lutomirski
2014-06-13 1:49 ` H. Peter Anvin
2014-06-13 1:52 ` Andy Lutomirski
2014-06-13 1:54 ` H. Peter Anvin
2014-06-13 2:28 ` [tip:x86/vdso] x86/vdso: " tip-bot for Andy Lutomirski
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=tip-b4b31f6101433e4b8ee73779b69b935af07682f8@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome