From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH 1/2] Add x86_64 fastsem support
Date: Fri, 22 Aug 2008 18:04:42 +0200 [thread overview]
Message-ID: <48AEE39A.2070801@domain.hid> (raw)
As the subject says. Passed your unit_mutex test, nothing else tried
yet, weekend is calling.
---
configure.in | 1 +
include/asm-x86/atomic_64.h | 31 +++++++++++++++++++++++++++++--
ksrc/arch/x86/Kconfig | 2 +-
3 files changed, 31 insertions(+), 3 deletions(-)
Index: b/configure.in
===================================================================
--- a/configure.in
+++ b/configure.in
@@ -103,6 +103,7 @@ case "$host" in
XENO_TARGET_ARCH=x86
XENO_LINUX_ARCH=x86_64
XENO_LINUX_INSTALL_TARGET=install
+ CONFIG_XENO_FASTSEM=y
;;
*) echo ""
echo "*******************************************"
Index: b/include/asm-x86/atomic_64.h
===================================================================
--- a/include/asm-x86/atomic_64.h
+++ b/include/asm-x86/atomic_64.h
@@ -21,6 +21,10 @@
#define _XENO_ASM_X86_ATOMIC_64_H
#define _XENO_ASM_X86_ATOMIC_H
+#include <asm/xenomai/features.h>
+
+typedef unsigned long atomic_flags_t;
+
#ifdef __KERNEL__
#include <linux/bitops.h>
@@ -50,10 +54,20 @@ typedef atomic64_t xnarch_atomic_t;
#else /* !__KERNEL__ */
-#include <asm/xenomai/features.h>
+#ifdef CONFIG_SMP
+#define LOCK_PREFIX "lock ; "
+#else
+#define LOCK_PREFIX ""
+#endif
+
+typedef struct { unsigned long counter; } xnarch_atomic_t;
#define __xeno_xg(x) ((volatile long *)(x))
+#define xnarch_atomic_get(v) ((v)->counter)
+
+#define xnarch_atomic_set(v,i) (((v)->counter) = (i))
+
static inline unsigned long xnarch_atomic_xchg (volatile void *ptr,
unsigned long x)
{
@@ -64,12 +78,25 @@ static inline unsigned long xnarch_atomi
return x;
}
+static inline unsigned long
+xnarch_atomic_cmpxchg(xnarch_atomic_t *v, unsigned long old, unsigned long newval)
+{
+ volatile void *ptr = &v->counter;
+ unsigned long prev;
+
+ __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2"
+ : "=a"(prev)
+ : "r"(newval), "m"(*__xeno_xg(ptr)), "0"(old)
+ : "memory");
+ return prev;
+}
+
#define xnarch_memory_barrier() asm volatile("mfence":::"memory")
#define xnarch_read_memory_barrier() asm volatile("lfence":::"memory")
#define xnarch_write_memory_barrier() xnarch_memory_barrier()
#endif /* __KERNEL__ */
-typedef unsigned long atomic_flags_t;
+#include <asm-generic/xenomai/atomic.h>
#endif /* !_XENO_ASM_X86_ATOMIC_64_H */
Index: b/ksrc/arch/x86/Kconfig
===================================================================
--- a/ksrc/arch/x86/Kconfig
+++ b/ksrc/arch/x86/Kconfig
@@ -4,7 +4,7 @@ config XENO_GENERIC_STACKPOOL
config XENO_FASTSEM
bool
- default y if X86_32
+ default y
source "kernel/xenomai/nucleus/Kconfig"
next reply other threads:[~2008-08-22 16:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 16:04 Jan Kiszka [this message]
2008-08-22 16:26 ` [Xenomai-core] [PATCH 1/2] Add x86_64 fastsem support Gilles Chanteperdrix
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=48AEE39A.2070801@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.