From: pbonzini@redhat.com (Paolo Bonzini)
Subject: [ltt-dev] [PATCH 04/12] define sync_core for x86 PIC
Date: Fri, 19 Feb 2010 20:22:46 +0100 [thread overview]
Message-ID: <1266607374-1107-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1266607374-1107-1-git-send-email-pbonzini@redhat.com>
Pushing/popping the reserved ebx register is surely less expensive
than a memory barrier.
Note that since ebx is a callee-save register, this is even safe for
signals (i.e. it would be safe even if we needed the value that cpuid
puts in %%ebx).
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
urcu/arch_x86.h | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/urcu/arch_x86.h b/urcu/arch_x86.h
index c4674de..64cc026 100644
--- a/urcu/arch_x86.h
+++ b/urcu/arch_x86.h
@@ -49,9 +49,13 @@ extern "C" {
/*
* Serialize core instruction execution. Also acts as a compiler barrier.
- * Cannot use cpuid on PIC because it clobbers the ebx register;
- * error: PIC register 'ebx' clobbered in 'asm'
+ * On PIC ebx cannot be clobbered
*/
+#ifdef __PIC__
+#define sync_core() \
+ asm volatile("push %%ebx; cpuid; pop %%ebx" \
+ : : : "memory", "eax", "ecx", "edx");
+#endif
#ifndef __PIC__
#define sync_core() \
asm volatile("cpuid" : : : "memory", "eax", "ebx", "ecx", "edx");
--
1.6.6
next prev parent reply other threads:[~2010-02-19 19:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-19 19:22 [ltt-dev] [PATCH 00/12] provide generic version of uatomic and other per-arch defs Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 01/12] use kernel style makefile output Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 02/12] use autoconf symbolic linking Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 03/12] add urcu/arch_generic.h Paolo Bonzini
2010-02-19 19:22 ` Paolo Bonzini [this message]
2010-02-19 19:22 ` [ltt-dev] [PATCH 05/12] remove compat_uatomic_cmpxchg #define from non-x86 Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 06/12] add uatomic_generic.h, use it for common definitions Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 07/12] use uatomic_generic.h for common fallback implementations Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 08/12] move whether atomic byte/short exists to uatomic_arch_*.h Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 09/12] add Alpha support Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 10/12] support compiling on unknown architectures Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 11/12] avoid multiple evaluation of STORE_SHARED argument Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 12/12] centralize definition of BITS_PER_LONG Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2010-02-15 19:04 [ltt-dev] [PATCH 00/12] provide default definition of uatomic builtins Paolo Bonzini
2010-02-15 19:04 ` [ltt-dev] [PATCH 04/12] define sync_core for x86 PIC Paolo Bonzini
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=1266607374-1107-5-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
/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