Module: xenomai-2.5
Branch: master
Commit: 8dfad37c521053642f9cd4fcb58963900488f8b2
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=8dfad37c521053642f9cd4fcb58963900488f8b2

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Mon Mar  8 21:51:18 2010 +0100

common: add access in user-space to nkvdso

---

 src/skins/common/Makefile.am    |    6 +-----
 src/skins/common/Makefile.in    |   11 +++--------
 src/skins/common/sem_heap.c     |   19 +++++++++++++++++++
 src/testsuite/unit/Makefile.am  |    6 ++----
 src/testsuite/unit/Makefile.in  |    4 +---
 src/testsuite/unit/check-vdso.c |   16 +---------------
 6 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/src/skins/common/Makefile.am b/src/skins/common/Makefile.am
index e9d4ab6..8099e9f 100644
--- a/src/skins/common/Makefile.am
+++ b/src/skins/common/Makefile.am
@@ -1,11 +1,7 @@
 lib_LTLIBRARIES = libxenomai.la
 noinst_HEADERS = sem_heap.h
 
-libxenomai_la_SOURCES = bind.c current.c sigshadow.c timeconv.c
-
-if CONFIG_XENO_FASTSYNCH
-libxenomai_la_SOURCES += sem_heap.c
-endif
+libxenomai_la_SOURCES = bind.c current.c sigshadow.c timeconv.c sem_heap.c
 
 libxenomai_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 0:0:0 -lpthread
 
diff --git a/src/skins/common/Makefile.in b/src/skins/common/Makefile.in
index 85a6333..55aa288 100644
--- a/src/skins/common/Makefile.in
+++ b/src/skins/common/Makefile.in
@@ -34,7 +34,6 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-...@config_xeno_fastsynch_true@am__append_1 = sem_heap.c
 subdir = src/skins/common
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in
@@ -62,12 +61,9 @@ am__installdirs = "$(DESTDIR)$(libdir)"
 libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libxenomai_la_LIBADD =
-am__libxenomai_la_SOURCES_DIST = bind.c current.c sigshadow.c \
-       timeconv.c sem_heap.c
-...@config_xeno_fastsynch_true@am__objects_1 = libxenomai_la-sem_heap.lo
 am_libxenomai_la_OBJECTS = libxenomai_la-bind.lo \
        libxenomai_la-current.lo libxenomai_la-sigshadow.lo \
-       libxenomai_la-timeconv.lo $(am__objects_1)
+       libxenomai_la-timeconv.lo libxenomai_la-sem_heap.lo
 libxenomai_la_OBJECTS = $(am_libxenomai_la_OBJECTS)
 libxenomai_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -85,7 +81,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) 
\
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
 SOURCES = $(libxenomai_la_SOURCES)
-DIST_SOURCES = $(am__libxenomai_la_SOURCES_DIST)
+DIST_SOURCES = $(libxenomai_la_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -252,8 +248,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libxenomai.la
 noinst_HEADERS = sem_heap.h
-libxenomai_la_SOURCES = bind.c current.c sigshadow.c timeconv.c \
-       $(am__append_1)
+libxenomai_la_SOURCES = bind.c current.c sigshadow.c timeconv.c sem_heap.c
 libxenomai_la_LDFLAGS = @XENO_DLOPEN_CONSTRAINT@ -version-info 0:0:0 -lpthread
 libxenomai_la_CPPFLAGS = \
        @XENO_USER_CFLAGS@ \
diff --git a/src/skins/common/sem_heap.c b/src/skins/common/sem_heap.c
index 55ad7d1..97888f1 100644
--- a/src/skins/common/sem_heap.c
+++ b/src/skins/common/sem_heap.c
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <unistd.h>
 #include <pthread.h>
@@ -14,6 +15,7 @@
 #include "sem_heap.h"
 
 unsigned long xeno_sem_heap[2] = { 0, 0 };
+struct xnvdso *nkvdso;
 
 static void *map_sem_heap(unsigned shared)
 {
@@ -76,6 +78,21 @@ static void remap_on_fork(void)
        }
 }
 
+static void xeno_init_vdso(void)
+{
+       xnsysinfo_t sysinfo;
+       int err;
+
+       err = XENOMAI_SYSCALL2(__xn_sys_info, 0, &sysinfo);
+       if (err < 0) {
+               fprintf(stderr, "Xenomai: sys_info failed: %s\n",
+                       strerror(-err));
+               exit(EXIT_FAILURE);
+       }
+
+       nkvdso = (struct xnvdso *)(xeno_sem_heap[1] + sysinfo.vdso);
+}
+
 static void xeno_init_sem_heaps_inner(void)
 {
        xeno_sem_heap[0] = (unsigned long) map_sem_heap(0);
@@ -90,6 +107,8 @@ static void xeno_init_sem_heaps_inner(void)
                perror("Xenomai: mmap(global sem heap)");
                exit(EXIT_FAILURE);
        }
+
+       xeno_init_vdso();
 }
 
 void xeno_init_sem_heaps(void)
diff --git a/src/testsuite/unit/Makefile.am b/src/testsuite/unit/Makefile.am
index 8d5bacf..d94e53f 100644
--- a/src/testsuite/unit/Makefile.am
+++ b/src/testsuite/unit/Makefile.am
@@ -9,10 +9,8 @@ test_PROGRAMS = \
        mutex-torture-posix \
        mutex-torture-native \
        cond-torture-posix \
-       cond-torture-native
-if CONFIG_XENO_FASTSYNCH
-test_PROGRAMS += check-vdso
-endif
+       cond-torture-native \
+       check-vdso
 
 arith_SOURCES = arith.c arith-noinline.c arith-noinline.h
 
diff --git a/src/testsuite/unit/Makefile.in b/src/testsuite/unit/Makefile.in
index 59cb515..3d536a8 100644
--- a/src/testsuite/unit/Makefile.in
+++ b/src/testsuite/unit/Makefile.in
@@ -36,8 +36,7 @@ target_triplet = @target@
 test_PROGRAMS = arith$(EXEEXT) wakeup-time$(EXEEXT) \
        mutex-torture-posix$(EXEEXT) mutex-torture-native$(EXEEXT) \
        cond-torture-posix$(EXEEXT) cond-torture-native$(EXEEXT) \
-       $(am__EXEEXT_1)
-...@config_xeno_fastsynch_true@am__append_1 = check-vdso
+       check-vdso$(EXEEXT)
 subdir = src/testsuite/unit
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -54,7 +53,6 @@ am__configure_deps = $(am__aclocal_m4_deps) 
$(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/include/xeno_config.h
 CONFIG_CLEAN_FILES =
-...@config_xeno_fastsynch_true@am__EXEEXT_1 = check-vdso$(EXEEXT)
 am__installdirs = "$(DESTDIR)$(testdir)"
 testPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(test_PROGRAMS)
diff --git a/src/testsuite/unit/check-vdso.c b/src/testsuite/unit/check-vdso.c
index f237791..38805be 100644
--- a/src/testsuite/unit/check-vdso.c
+++ b/src/testsuite/unit/check-vdso.c
@@ -12,10 +12,8 @@ extern unsigned long xeno_sem_heap[2];
 
 int main(int argc, char **argv)
 {
-       int err;
-       xnsysinfo_t sysinfo;
-       struct xnvdso *nkvdso;
        unsigned long long test_features;
+       int err;
 
        if (argc != 2) {
                printf("No specific feature(s) given, using XNVDSO_FEATURE\n");
@@ -30,18 +28,6 @@ int main(int argc, char **argv)
                return 1;
        }
 
-       /* The muxid is irrelevant for this test as long as it's valid */
-       err = XENOMAI_SYSCALL2(__xn_sys_info, 1, &sysinfo);
-       if (err < 0) {
-               fprintf(stderr, "sys_sys_info failed: %d\n", err);
-               return 1;
-       }
-
-       printf("Address of the global semaphore heap: 0x%lx\n",
-              xeno_sem_heap[1]);
-       printf("Offset of xnvdso: %lu\n", sysinfo.vdso);
-
-       nkvdso = (struct xnvdso *)(xeno_sem_heap[1] + sysinfo.vdso);
        printf("Contents of the features flag: %llu\n", nkvdso->features);
 
        if (nkvdso->features == test_features)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to