Module: xenomai-3
Branch: master
Commit: 6cd480017f082ff0eb5acbc621849646d865c222
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6cd480017f082ff0eb5acbc621849646d865c222

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Oct 30 15:24:38 2014 +0100

cobalt/kernel, lib/cobalt: drop sc_cobalt_info syscall

This syscall had no point, given that the reported information is
purely static. sc_cobalt_bind is the right place to pass this
information back to userland which needs it only once, in order to
bootstrap lib/cobalt.

---

 include/cobalt/uapi/asm-generic/features.h |   22 ++++++++++++++++------
 include/cobalt/uapi/asm-generic/syscall.h  |    9 ++-------
 include/cobalt/uapi/syscall.h              |    2 +-
 kernel/cobalt/posix/syscall.c              |   16 +++-------------
 lib/cobalt/init.c                          |   14 ++------------
 lib/cobalt/umm.c                           |   24 ++++--------------------
 lib/cobalt/umm.h                           |    4 +++-
 7 files changed, 31 insertions(+), 60 deletions(-)

diff --git a/include/cobalt/uapi/asm-generic/features.h 
b/include/cobalt/uapi/asm-generic/features.h
index 797e4ce..f62b4b1 100644
--- a/include/cobalt/uapi/asm-generic/features.h
+++ b/include/cobalt/uapi/asm-generic/features.h
@@ -23,16 +23,26 @@
 #define XNFEAT_STRING_LEN 64
 
 struct cobalt_featinfo {
-       __u32 feat_abirev;  /* ABI revision level. */
-       __u32 feat_all;     /* Available feature set. */
-       __u32 feat_man;     /* Mandatory features (when requested). */
-       __u32 feat_req;     /* Requested feature set. */
-       __u32 feat_mis;     /* Missing features. */
+       /** Real-time clock frequency */
+       __u64 clock_freq;
+       /** Offset of nkvdso in the sem heap. */
+       __u32 vdso_offset;
+       /** ABI revision level. */
+       __u32 feat_abirev;
+       /** Available feature set. */
+       __u32 feat_all;
+       /** Mandatory features (when requested). */
+       __u32 feat_man;
+       /** Requested feature set. */
+       __u32 feat_req;
+       /** Missing features. */
+       __u32 feat_mis;
        char feat_all_s[XNFEAT_STRING_LEN];
        char feat_man_s[XNFEAT_STRING_LEN];
        char feat_req_s[XNFEAT_STRING_LEN];
        char feat_mis_s[XNFEAT_STRING_LEN];
-       struct cobalt_featinfo_archdep feat_arch; /* Arch-dep extension. */
+       /* Architecture-specific features. */
+       struct cobalt_featinfo_archdep feat_arch;
 };
 
 #define __xn_feat_smp         0x80000000
diff --git a/include/cobalt/uapi/asm-generic/syscall.h 
b/include/cobalt/uapi/asm-generic/syscall.h
index 0cdb032..b38b241 100644
--- a/include/cobalt/uapi/asm-generic/syscall.h
+++ b/include/cobalt/uapi/asm-generic/syscall.h
@@ -26,9 +26,9 @@
 
 struct cobalt_bindreq {
        /** Features userland requires. */
-       int feat_req;
+       __u32 feat_req;
        /** ABI revision userland uses. */
-       int abi_rev;
+       __u32 abi_rev;
        /** Features the Cobalt core provides. */
        struct cobalt_featinfo feat_ret;
 };
@@ -36,9 +36,4 @@ struct cobalt_bindreq {
 #define COBALT_SECONDARY  0
 #define COBALT_PRIMARY    1
 
-struct cobalt_sysinfo {
-       __u64 clockfreq;        /* Real-time clock frequency */
-       __u32 vdso;             /* Offset of nkvdso in the sem heap */
-};
-
 #endif /* !_COBALT_UAPI_ASM_GENERIC_SYSCALL_H */
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 0f74f37..e907c4b 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -110,7 +110,7 @@
 #define sc_cobalt_select                       87
 #define sc_cobalt_migrate                      88
 #define sc_cobalt_archcall                     89
-#define sc_cobalt_info                         90
+/* 90 unimp */
 #define sc_cobalt_trace                                91
 #define sc_cobalt_sysctl                       92
 #define sc_cobalt_get_current                  93
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 60a385b..03ec81d 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -130,17 +130,6 @@ static COBALT_SYSCALL(migrate, current, int, (int domain))
        return 0;
 }
 
-static COBALT_SYSCALL(info, lostage,
-                     int, (struct cobalt_sysinfo __user *u_info))
-{
-       struct cobalt_sysinfo info;
-
-       info.clockfreq = xnarch_machdata.clock_freq;
-       info.vdso = cobalt_umm_offset(&cobalt_ppd_get(1)->umm, nkvdso);
-
-       return __xn_safe_copy_to_user(u_info, &info, sizeof(info));
-}
-
 static COBALT_SYSCALL(trace, current,
                      int, (int op, unsigned long a1,
                            unsigned long a2, unsigned long a3))
@@ -341,6 +330,9 @@ static COBALT_SYSCALL(bind, lostage,
        f->feat_abirev = XENOMAI_ABI_REV;
        collect_arch_features(f);
 
+       f->clock_freq = xnarch_machdata.clock_freq;
+       f->vdso_offset = cobalt_umm_offset(&cobalt_ppd_get(1)->umm, nkvdso);
+
        if (__xn_safe_copy_to_user(u_breq, &breq, sizeof(breq)))
                return -EFAULT;
 
@@ -603,7 +595,6 @@ static const cobalt_syshand cobalt_syscalls[] = {
        __COBALT_CALL_ENTRY(archcall),
        __COBALT_CALL_ENTRY(bind),
        __COBALT_CALL_ENTRY(extend),
-       __COBALT_CALL_ENTRY(info),
        __COBALT_CALL_ENTRY(trace),
        __COBALT_CALL_ENTRY(get_current),
        __COBALT_CALL_ENTRY(mayday),
@@ -708,7 +699,6 @@ static const int cobalt_sysmodes[] = {
        __COBALT_MODE(archcall, current),
        __COBALT_MODE(bind, lostage),
        __COBALT_MODE(extend, lostage),
-       __COBALT_MODE(info, lostage),
        __COBALT_MODE(trace, current),
        __COBALT_MODE(get_current, current),
        __COBALT_MODE(mayday, oneway),
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 8ba9902..dfe1150 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -62,7 +62,6 @@ static void sigill_handler(int sig)
 static void low_init(void)
 {
        sighandler_t old_sigill_handler;
-       struct cobalt_sysinfo sysinfo;
        struct cobalt_bindreq breq;
        struct cobalt_featinfo *f;
        int ret;
@@ -101,18 +100,9 @@ static void low_init(void)
        }
 
        cobalt_check_features(f);
-
-       ret = XENOMAI_SYSCALL1(sc_cobalt_info, &sysinfo);
-       if (ret) {
-               report_error("sysinfo failed: %s", strerror(-ret));
-               exit(EXIT_FAILURE);
-       }
-
-       cobalt_init_umm();
-
+       cobalt_init_umm(f->vdso_offset);
        cobalt_init_current_keys();
-
-       cobalt_ticks_init(sysinfo.clockfreq);
+       cobalt_ticks_init(f->clock_freq);
 }
 
 static void __init_cobalt(void);
diff --git a/lib/cobalt/umm.c b/lib/cobalt/umm.c
index 16b0f31..a09b2d6 100644
--- a/lib/cobalt/umm.c
+++ b/lib/cobalt/umm.c
@@ -101,20 +101,6 @@ static void unmap_on_fork(void)
        init_bind_once = PTHREAD_ONCE_INIT;
 }
 
-static void init_vdso(void)
-{
-       struct cobalt_sysinfo sysinfo;
-       int ret;
-
-       ret = XENOMAI_SYSCALL1(sc_cobalt_info, &sysinfo);
-       if (ret < 0) {
-               report_error("sysinfo failed: %s", strerror(-ret));
-               exit(EXIT_FAILURE);
-       }
-
-       cobalt_vdso = (struct xnvdso *)(cobalt_umm_shared + sysinfo.vdso);
-}
-
 /*
  * Will be called once at library loading time, and when re-binding
  * after a fork.
@@ -131,7 +117,7 @@ static void init_bind(void)
 }
 
 /* Will be called only once, at library loading time. */
-static void init_loadup(void)
+static void init_loadup(__u32 vdso_offset)
 {
        uint32_t size;
 
@@ -144,13 +130,11 @@ static void init_loadup(void)
                exit(EXIT_FAILURE);
        }
 
-       init_vdso();
+       cobalt_vdso = (struct xnvdso *)(cobalt_umm_shared + vdso_offset);
 }
 
-void cobalt_init_umm(void)
+void cobalt_init_umm(__u32 vdso_offset)
 {
-       static pthread_once_t init_loadup_once = PTHREAD_ONCE_INIT;
-
        pthread_once(&init_bind_once, init_bind);
-       pthread_once(&init_loadup_once, init_loadup);
+       init_loadup(vdso_offset);
 }
diff --git a/lib/cobalt/umm.h b/lib/cobalt/umm.h
index e0e3cf8..5647758 100644
--- a/lib/cobalt/umm.h
+++ b/lib/cobalt/umm.h
@@ -18,7 +18,9 @@
 #ifndef _LIB_COBALT_UMM_H
 #define _LIB_COBALT_UMM_H
 
-void cobalt_init_umm(void);
+#include <linux/types.h>
+
+void cobalt_init_umm(__u32 vdso_offset);
 
 struct xnvdso;
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to