[Xenomai-git] Philippe Gerum : cobalt: fixup generic 32bit syscall support

2014-10-30 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 367867fafbd9174fec9cfcae06979911e3a78c50
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=367867fafbd9174fec9cfcae06979911e3a78c50

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:20:49 2014 +0200

cobalt: fixup generic 32bit syscall support

---

 include/cobalt/kernel/rtdm/fd.h|   25 +-
 include/cobalt/uapi/syscall.h  |2 +-
 kernel/cobalt/Kconfig  |3 -
 kernel/cobalt/debug.c  |   26 +-
 kernel/cobalt/debug.h  |4 +-
 .../cobalt/include/asm-generic/xenomai/syscall.h   |5 ++
 .../cobalt/include/asm-generic/xenomai/syscall32.h |6 +-
 kernel/cobalt/posix/syscall.c  |   88 +++-
 kernel/cobalt/rtdm/fd.c|   45 +-
 9 files changed, 146 insertions(+), 58 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h
index cf47fcb..51609b3 100644
--- a/include/cobalt/kernel/rtdm/fd.h
+++ b/include/cobalt/kernel/rtdm/fd.h
@@ -24,6 +24,7 @@
 #include linux/socket.h
 #include linux/file.h
 #include cobalt/kernel/tree.h
+#include asm-generic/xenomai/syscall.h
 
 struct vm_area_struct;
 struct rtdm_fd;
@@ -299,30 +300,48 @@ struct rtdm_fd {
unsigned int refs;
int minor;
int oflags;
+#ifdef CONFIG_COMPAT
+   int compat;
+#endif
struct list_head cleanup;
 };
 
 #define RTDM_FD_MAGIC 0x5256
 
+#define RTDM_FD_COMPAT __COBALT_COMPAT_BIT
+#define RTDM_FD_COMPATX__COBALT_COMPATX_BIT
+
 int __rtdm_anon_getfd(const char *name, int flags);
 
 void __rtdm_anon_putfd(int ufd);
 
-static inline struct cobalt_ppd *rtdm_fd_owner(struct rtdm_fd *fd)
+static inline struct cobalt_ppd *rtdm_fd_owner(const struct rtdm_fd *fd)
 {
return fd-owner;
 }
 
-static inline int rtdm_fd_minor(struct rtdm_fd *fd)
+static inline int rtdm_fd_minor(const struct rtdm_fd *fd)
 {
return fd-minor;
 }
 
-static inline int rtdm_fd_flags(struct rtdm_fd *fd)
+static inline int rtdm_fd_flags(const struct rtdm_fd *fd)
 {
return fd-oflags;
 }
 
+#ifdef CONFIG_COMPAT
+static inline int rtdm_fd_compat(const struct rtdm_fd *fd)
+{
+   return fd-compat;
+}
+#else
+static inline int rtdm_fd_compat(const struct rtdm_fd *fd)
+{
+   return 0;
+}
+#endif
+
 int rtdm_fd_enter(struct rtdm_fd *rtdm_fd, int ufd,
  unsigned int magic, struct rtdm_fd_ops *ops);
 
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 59d90e5..aa364a1 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -120,6 +120,6 @@
 #define sc_cobalt_extend   97
 #define sc_cobalt_sysconf  98
 
-#define __NR_COBALT_SYSCALLS   100
+#define __NR_COBALT_SYSCALLS   128 /* Power of 2 */
 
 #endif /* !_COBALT_UAPI_SYSCALL_H */
diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index c4185b2..2e49d37 100644
--- a/kernel/cobalt/Kconfig
+++ b/kernel/cobalt/Kconfig
@@ -257,9 +257,6 @@ config XENO_OPT_VFILE
depends on PROC_FS
default y
 
-config XENO_OPT_SYS3264
-   bool
-
 endmenu
 
 menu Sizes and static limits
diff --git a/kernel/cobalt/debug.c b/kernel/cobalt/debug.c
index a809dc9..ad72a3e 100644
--- a/kernel/cobalt/debug.c
+++ b/kernel/cobalt/debug.c
@@ -111,7 +111,6 @@ out:
  */
 #define RELAX_SPOTNR   128
 #define RELAX_HSLOTS   (1  8)
-#define RELAX_CALLDEPTHSIGSHADOW_BACKTRACE_DEPTH
 
 struct relax_record {
/* Number of hits for this location */
@@ -124,7 +123,7 @@ struct relax_record {
struct backtrace {
unsigned long pc;
const char *mapname;
-   } backtrace[RELAX_CALLDEPTH];
+   } backtrace[SIGSHADOW_BACKTRACE_DEPTH];
/* Program hash value of the caller. */
u32 proghash;
/* Pid of the caller. */
@@ -201,10 +200,9 @@ void xndebug_notify_relax(struct xnthread *thread, int 
reason)
  sigshadow_int(SIGSHADOW_ACTION_BACKTRACE, reason));
 }
 
-void xndebug_trace_relax(int nr, unsigned long __user *u_backtrace,
+void xndebug_trace_relax(int nr, unsigned long *backtrace,
 int reason)
 {
-   unsigned long backtrace[RELAX_CALLDEPTH];
struct relax_record *p, **h;
struct vm_area_struct *vma;
struct xnthread *thread;
@@ -220,25 +218,7 @@ void xndebug_trace_relax(int nr, unsigned long __user 
*u_backtrace,
thread = xnthread_current();
if (thread == NULL)
return; /* Can't be, right? What a mess. */
-   /*
-* In case backtrace() in userland is broken or fails. We may
-* want to know about this in kernel space however, for future
-* use.
-*/
-   if (nr = 0)
-   

[Xenomai-git] Philippe Gerum : cobalt: fixup generic 32bit syscall support

2014-10-17 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 367867fafbd9174fec9cfcae06979911e3a78c50
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=367867fafbd9174fec9cfcae06979911e3a78c50

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Oct 16 14:20:49 2014 +0200

cobalt: fixup generic 32bit syscall support

---

 include/cobalt/kernel/rtdm/fd.h|   25 +-
 include/cobalt/uapi/syscall.h  |2 +-
 kernel/cobalt/Kconfig  |3 -
 kernel/cobalt/debug.c  |   26 +-
 kernel/cobalt/debug.h  |4 +-
 .../cobalt/include/asm-generic/xenomai/syscall.h   |5 ++
 .../cobalt/include/asm-generic/xenomai/syscall32.h |6 +-
 kernel/cobalt/posix/syscall.c  |   88 +++-
 kernel/cobalt/rtdm/fd.c|   45 +-
 9 files changed, 146 insertions(+), 58 deletions(-)

diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h
index cf47fcb..51609b3 100644
--- a/include/cobalt/kernel/rtdm/fd.h
+++ b/include/cobalt/kernel/rtdm/fd.h
@@ -24,6 +24,7 @@
 #include linux/socket.h
 #include linux/file.h
 #include cobalt/kernel/tree.h
+#include asm-generic/xenomai/syscall.h
 
 struct vm_area_struct;
 struct rtdm_fd;
@@ -299,30 +300,48 @@ struct rtdm_fd {
unsigned int refs;
int minor;
int oflags;
+#ifdef CONFIG_COMPAT
+   int compat;
+#endif
struct list_head cleanup;
 };
 
 #define RTDM_FD_MAGIC 0x5256
 
+#define RTDM_FD_COMPAT __COBALT_COMPAT_BIT
+#define RTDM_FD_COMPATX__COBALT_COMPATX_BIT
+
 int __rtdm_anon_getfd(const char *name, int flags);
 
 void __rtdm_anon_putfd(int ufd);
 
-static inline struct cobalt_ppd *rtdm_fd_owner(struct rtdm_fd *fd)
+static inline struct cobalt_ppd *rtdm_fd_owner(const struct rtdm_fd *fd)
 {
return fd-owner;
 }
 
-static inline int rtdm_fd_minor(struct rtdm_fd *fd)
+static inline int rtdm_fd_minor(const struct rtdm_fd *fd)
 {
return fd-minor;
 }
 
-static inline int rtdm_fd_flags(struct rtdm_fd *fd)
+static inline int rtdm_fd_flags(const struct rtdm_fd *fd)
 {
return fd-oflags;
 }
 
+#ifdef CONFIG_COMPAT
+static inline int rtdm_fd_compat(const struct rtdm_fd *fd)
+{
+   return fd-compat;
+}
+#else
+static inline int rtdm_fd_compat(const struct rtdm_fd *fd)
+{
+   return 0;
+}
+#endif
+
 int rtdm_fd_enter(struct rtdm_fd *rtdm_fd, int ufd,
  unsigned int magic, struct rtdm_fd_ops *ops);
 
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 59d90e5..aa364a1 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -120,6 +120,6 @@
 #define sc_cobalt_extend   97
 #define sc_cobalt_sysconf  98
 
-#define __NR_COBALT_SYSCALLS   100
+#define __NR_COBALT_SYSCALLS   128 /* Power of 2 */
 
 #endif /* !_COBALT_UAPI_SYSCALL_H */
diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index c4185b2..2e49d37 100644
--- a/kernel/cobalt/Kconfig
+++ b/kernel/cobalt/Kconfig
@@ -257,9 +257,6 @@ config XENO_OPT_VFILE
depends on PROC_FS
default y
 
-config XENO_OPT_SYS3264
-   bool
-
 endmenu
 
 menu Sizes and static limits
diff --git a/kernel/cobalt/debug.c b/kernel/cobalt/debug.c
index a809dc9..ad72a3e 100644
--- a/kernel/cobalt/debug.c
+++ b/kernel/cobalt/debug.c
@@ -111,7 +111,6 @@ out:
  */
 #define RELAX_SPOTNR   128
 #define RELAX_HSLOTS   (1  8)
-#define RELAX_CALLDEPTHSIGSHADOW_BACKTRACE_DEPTH
 
 struct relax_record {
/* Number of hits for this location */
@@ -124,7 +123,7 @@ struct relax_record {
struct backtrace {
unsigned long pc;
const char *mapname;
-   } backtrace[RELAX_CALLDEPTH];
+   } backtrace[SIGSHADOW_BACKTRACE_DEPTH];
/* Program hash value of the caller. */
u32 proghash;
/* Pid of the caller. */
@@ -201,10 +200,9 @@ void xndebug_notify_relax(struct xnthread *thread, int 
reason)
  sigshadow_int(SIGSHADOW_ACTION_BACKTRACE, reason));
 }
 
-void xndebug_trace_relax(int nr, unsigned long __user *u_backtrace,
+void xndebug_trace_relax(int nr, unsigned long *backtrace,
 int reason)
 {
-   unsigned long backtrace[RELAX_CALLDEPTH];
struct relax_record *p, **h;
struct vm_area_struct *vma;
struct xnthread *thread;
@@ -220,25 +218,7 @@ void xndebug_trace_relax(int nr, unsigned long __user 
*u_backtrace,
thread = xnthread_current();
if (thread == NULL)
return; /* Can't be, right? What a mess. */
-   /*
-* In case backtrace() in userland is broken or fails. We may
-* want to know about this in kernel space however, for future
-* use.
-*/
-   if (nr = 0)
-