Module: xenomai-abe
Branch: comedi
Commit: 3833f60a87ee2c0b09d576619f2ef86e2c6395fb
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=3833f60a87ee2c0b09d576619f2ef86e2c6395fb

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Sep 16 16:59:43 2009 +0200

nucleus: introduce arch-dep extension of the feature set

Some archs may want to export additional (non-generic) information via
the xnsysinfo struct to an application, when the latter binds to the
real-time core.

Introduce an arch-specific block within the xnsysinfo struct to convey
them.

---

 include/asm-generic/bits/bind.h |   10 ++++++++--
 include/asm-generic/features.h  |   20 ++++++++++++++++++++
 include/asm-generic/syscall.h   |   28 ++++------------------------
 ksrc/nucleus/shadow.c           |   10 ++++++----
 4 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/include/asm-generic/bits/bind.h b/include/asm-generic/bits/bind.h
index 87cef48..3684b21 100644
--- a/include/asm-generic/bits/bind.h
+++ b/include/asm-generic/bits/bind.h
@@ -154,6 +154,8 @@ void __attribute__((weak)) xeno_sigill_handler(int sig)
        exit(1);
 }
 
+struct xnfeatinfo xeno_featinfo;
+
 static inline int
 xeno_bind_skin(unsigned skin_magic, const char *skin, const char *module)
 {
@@ -186,7 +188,7 @@ xeno_bind_skin(unsigned skin_magic, const char *skin, const 
char *module)
 
                fprintf(stderr, "Xenomai: incompatible ABI revision level\n");
                fprintf(stderr, "(needed=%lu, current=%lu).\n",
-                       XENOMAI_ABI_REV, finfo.abirev);
+                       XENOMAI_ABI_REV, finfo.feat_abirev);
                exit(1);
 
        case -ENOSYS:
@@ -237,6 +239,8 @@ xeno_bind_skin(unsigned skin_magic, const char *skin, const 
char *module)
        }
 #endif /* CONFIG_XENO_FASTSYNCH */
 
+       xeno_featinfo = finfo;
+
        return muxid;
 }
 
@@ -271,7 +275,7 @@ xeno_bind_skin_opt(unsigned skin_magic, const char *skin, 
const char *module)
 
                fprintf(stderr, "Xenomai: incompatible ABI revision level\n");
                fprintf(stderr, "(needed=%lu, current=%lu).\n",
-                       XENOMAI_ABI_REV, finfo.abirev);
+                       XENOMAI_ABI_REV, finfo.feat_abirev);
                exit(1);
 
        case -ENOSYS:
@@ -311,6 +315,8 @@ xeno_bind_skin_opt(unsigned skin_magic, const char *skin, 
const char *module)
        }
 #endif /* CONFIG_XENO_FASTSYNCH */
 
+       xeno_featinfo = finfo;
+
        return muxid;
 }
 
diff --git a/include/asm-generic/features.h b/include/asm-generic/features.h
index dd5269e..ff53915 100644
--- a/include/asm-generic/features.h
+++ b/include/asm-generic/features.h
@@ -21,10 +21,30 @@
 
 #ifdef __KERNEL__
 #include <linux/version.h>
+#ifndef xnfeatinfo_archdep
+#define collect_arch_features(finfo) do { (void)(finfo); } while (0)
+#endif /* !xnfeatinfo_archdep */
 #else /* !__KERNEL__ */
 #include <xeno_config.h>
 #endif /* __KERNEL__ */
 
+#define XNFEAT_STRING_LEN 64
+
+typedef struct xnfeatinfo {
+       unsigned long feat_all; /* Available feature set. */
+       char feat_all_s[XNFEAT_STRING_LEN];
+       unsigned long feat_man; /* Mandatory features (when requested). */
+       char feat_man_s[XNFEAT_STRING_LEN];
+       unsigned long feat_req; /* Requested feature set. */
+       char feat_req_s[XNFEAT_STRING_LEN];
+       unsigned long feat_mis; /* Missing features. */
+       char feat_mis_s[XNFEAT_STRING_LEN];
+#ifdef xnfeatinfo_archdep
+       struct xnfeatinfo_archdep feat_arch; /* Arch-dep extension. */
+#endif 
+       unsigned long feat_abirev; /* ABI revision level. */
+} xnfeatinfo_t;
+
 #define __xn_feat_smp         0x80000000
 #define __xn_feat_nosmp       0x40000000
 #define __xn_feat_fastsynch   0x20000000
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 1780d7f..09c9128 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -39,27 +39,9 @@
 #define XENOMAI_LINUX_DOMAIN  0
 #define XENOMAI_XENO_DOMAIN   1
 
-typedef struct xnfeatinfo {
-
-#define XNFEAT_STRING_LEN 64
-
-    unsigned long feat_all;    /* Available feature set. */
-    char feat_all_s[XNFEAT_STRING_LEN];
-    unsigned long feat_man;    /* Mandatory features (when requested). */
-    char feat_man_s[XNFEAT_STRING_LEN];
-    unsigned long feat_req;    /* Requested feature set. */
-    char feat_req_s[XNFEAT_STRING_LEN];
-    unsigned long feat_mis;    /* Missing features. */
-    char feat_mis_s[XNFEAT_STRING_LEN];
-
-    unsigned long abirev;      /* ABI revision level. */
-
-} xnfeatinfo_t;
-
 typedef struct xnsysinfo {
-
-    unsigned long long cpufreq;        /* CPU frequency */
-    unsigned long tickval;     /* Tick duration (ns) */
+       unsigned long long cpufreq;     /* CPU frequency */
+       unsigned long tickval;          /* Tick duration (ns) */
 } xnsysinfo_t;
 
 #define SIGSHADOW  SIGWINCH
@@ -159,10 +141,8 @@ static inline int __xn_safe_strncpy_from_user(char *dst,
 #endif /* __KERNEL__ */
 
 typedef struct xncompletion {
-
-    long syncflag;             /* Semaphore variable. */
-    pid_t pid;                 /* Single waiter ID. */
-
+       long syncflag;          /* Semaphore variable. */
+       pid_t pid;              /* Single waiter ID. */
 } xncompletion_t;
 
 #endif /* !_XENO_ASM_GENERIC_SYSCALL_H */
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index ee59923..d6d1203 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1466,9 +1466,10 @@ static int xnshadow_sys_bind(struct pt_regs *regs)
        featmis = (~XENOMAI_FEAT_DEP & (featdep & XENOMAI_FEAT_MAN));
 
        if (infarg) {
-               /* Pass back the supported feature set and the ABI revision
-                  level to user-space. */
-
+               /*
+                * Pass back the supported feature set and the ABI revision
+                * level to user-space.
+                */
                finfo.feat_all = XENOMAI_FEAT_DEP;
                stringify_feature_set(XENOMAI_FEAT_DEP, finfo.feat_all_s,
                                      sizeof(finfo.feat_all_s));
@@ -1481,7 +1482,8 @@ static int xnshadow_sys_bind(struct pt_regs *regs)
                finfo.feat_req = featdep;
                stringify_feature_set(featdep, finfo.feat_req_s,
                                      sizeof(finfo.feat_req_s));
-               finfo.abirev = XENOMAI_ABI_REV;
+               finfo.feat_abirev = XENOMAI_ABI_REV;
+               collect_arch_features(&finfo);
 
                if (__xn_safe_copy_to_user((void *)infarg, &finfo, 
sizeof(finfo)))
                        return -EFAULT;


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

Reply via email to