Module: xenomai-forge
Branch: next
Commit: d83fc6300cfa14a1519c0cd0e189bb4a30521422
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=d83fc6300cfa14a1519c0cd0e189bb4a30521422

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Sep  2 18:35:54 2014 +0200

cobalt/syscall: generic bits for 32->64bit syscall support

---

 kernel/cobalt/Kconfig                              |    3 +
 .../arch/arm/include/asm/xenomai/syscall32.h       |   24 ++
 .../arch/blackfin/include/asm/xenomai/syscall32.h  |   24 ++
 .../arch/nios2/include/asm/xenomai/syscall32.h     |   24 ++
 .../arch/powerpc/include/asm/xenomai/syscall32.h   |   24 ++
 .../cobalt/arch/sh/include/asm/xenomai/syscall32.h |   24 ++
 .../arch/x86/include/asm/xenomai/syscall32.h       |   54 ++++
 .../cobalt/include/asm-generic/xenomai/syscall32.h |   26 ++
 kernel/cobalt/posix/Makefile                       |    2 +
 kernel/cobalt/posix/syscall.c                      |  275 ++++++++++++--------
 kernel/cobalt/posix/syscall.h                      |    6 +
 kernel/cobalt/posix/syscall32.c                    |   35 +++
 12 files changed, 415 insertions(+), 106 deletions(-)

diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index aeb621a..58a61fb 100644
--- a/kernel/cobalt/Kconfig
+++ b/kernel/cobalt/Kconfig
@@ -264,6 +264,9 @@ 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/arch/arm/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/syscall32.h
new file mode 100644
index 0000000..95c5a11
--- /dev/null
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/syscall32.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef _COBALT_ARM_ASM_SYSCALL32_H
+#define _COBALT_ARM_ASM_SYSCALL32_H
+
+#include <asm-generic/xenomai/syscall32.h>
+
+#endif /* !_COBALT_ARM_ASM_SYSCALL32_H */
diff --git a/kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall32.h
new file mode 100644
index 0000000..651aef8
--- /dev/null
+++ b/kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall32.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef _COBALT_BLACKFIN_ASM_SYSCALL32_H
+#define _COBALT_BLACKFIN_ASM_SYSCALL32_H
+
+#include <asm-generic/xenomai/syscall32.h>
+
+#endif /* !_COBALT_BLACKFIN_ASM_SYSCALL32_H */
diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall32.h
new file mode 100644
index 0000000..72aad64
--- /dev/null
+++ b/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall32.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef _COBALT_NIOS2_ASM_SYSCALL32_H
+#define _COBALT_NIOS2_ASM_SYSCALL32_H
+
+#include <asm-generic/xenomai/syscall32.h>
+
+#endif /* !_COBALT_NIOS2_ASM_SYSCALL32_H */
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall32.h
new file mode 100644
index 0000000..15c977c
--- /dev/null
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall32.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef _COBALT_POWERPC_ASM_SYSCALL32_H
+#define _COBALT_POWERPC_ASM_SYSCALL32_H
+
+#include <asm-generic/xenomai/syscall32.h>
+
+#endif /* !_COBALT_POWERPC_ASM_SYSCALL32_H */
diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/sh/include/asm/xenomai/syscall32.h
new file mode 100644
index 0000000..1a93977
--- /dev/null
+++ b/kernel/cobalt/arch/sh/include/asm/xenomai/syscall32.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef _COBALT_SH_ASM_SYSCALL32_H
+#define _COBALT_SH_ASM_SYSCALL32_H
+
+#include <asm-generic/xenomai/syscall32.h>
+
+#endif /* !_COBALT_SH_ASM_SYSCALL32_H */
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
new file mode 100644
index 0000000..7d804e4
--- /dev/null
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef _COBALT_X86_ASM_SYSCALL32_H
+#define _COBALT_X86_ASM_SYSCALL32_H
+
+#ifdef CONFIG_X86_X32
+
+#include <linux/compat.h>
+
+#define __COBALT_X32_BASE      128
+
+#if __NR_COBALT_SYSCALLS >= __COBALT_X32_BASE
+#error "__NR_COBALT_SYSCALLS >= __COBALT_X32_BASE"
+#endif
+
+/* 32bit call entry, assigning __handler to call #__name. */
+#define __COBALT_CALL32_ENTRY(__name, __handler)               \
+       , [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler
+
+/* 32bit thunk implementation. */
+#define COBALT_SYSCALL32x(__name, __mode, __type, __args)      \
+       __typeof__(__type) cobalt32x_ ## __name __args
+
+/* 32bit thunk declaration. */
+#define COBALT_SYSCALL32x_DECL(__name, __type, __args) \
+       __typeof__(__type) cobalt32x_ ## __name __args
+
+#else /* !CONFIG_X86_X32 */
+
+/* x32 support disabled. */
+
+#define __COBALT_CALL32_ENTRY(__name, __handler)
+
+#define COBALT_SYSCALL32x_DECL(__name, __type, __args)
+
+#endif /* !CONFIG_X86_X32 */
+
+#endif /* !_COBALT_X86_ASM_SYSCALL32_H */
diff --git a/kernel/cobalt/include/asm-generic/xenomai/syscall32.h 
b/kernel/cobalt/include/asm-generic/xenomai/syscall32.h
new file mode 100644
index 0000000..1ffc546
--- /dev/null
+++ b/kernel/cobalt/include/asm-generic/xenomai/syscall32.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * Xenomai is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Xenomai; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef _COBALT_ASM_GENERIC_SYSCALL32_H
+#define _COBALT_ASM_GENERIC_SYSCALL32_H
+
+#define __COBALT_CALL32_ENTRY(__name, __handler)
+
+#define COBALT_SYSCALL32x_DECL(__name, __type, __args)
+
+#endif /* !_COBALT_ASM_GENERIC_SYSCALL32_H */
diff --git a/kernel/cobalt/posix/Makefile b/kernel/cobalt/posix/Makefile
index 5fa53b0..84bfab5 100644
--- a/kernel/cobalt/posix/Makefile
+++ b/kernel/cobalt/posix/Makefile
@@ -19,4 +19,6 @@ xenomai-y :=          \
        timer.o         \
        timerfd.o
 
+xenomai-$(CONFIG_XENO_OPT_SYS3264) += syscall32.o
+
 ccflags-y := -Iarch/$(SRCARCH)/xenomai/include -Iinclude/xenomai -Ikernel
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index da4bba6..12bb683 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -20,7 +20,6 @@
 #include <linux/err.h>
 #include <linux/ipipe.h>
 #include <linux/kconfig.h>
-#include <cobalt/uapi/syscall.h>
 #include <cobalt/uapi/sysconf.h>
 #include <cobalt/kernel/tree.h>
 #include <cobalt/kernel/vdso.h>
@@ -74,11 +73,11 @@
 /* Shorthand for oneway trap - does not return to call site. */
 #define __xn_exec_oneway    __xn_exec_norestart
 
-typedef int (*cobalt_handler)(unsigned long arg1, unsigned long arg2,
+typedef int (*cobalt_syshand)(unsigned long arg1, unsigned long arg2,
                              unsigned long arg3, unsigned long arg4,
                              unsigned long arg5);
 
-static const cobalt_handler cobalt_syscalls[];
+static const cobalt_syshand cobalt_syscalls[];
 
 static const int cobalt_sysmodes[];
 
@@ -110,7 +109,7 @@ static int handle_head_syscall(struct ipipe_domain *ipd, 
struct pt_regs *regs)
        struct cobalt_process *process;
        int nr, switched, ret, sigs;
        struct xnthread *thread;
-       cobalt_handler handler;
+       cobalt_syshand handler;
        struct task_struct *p;
        int sysflags;
 
@@ -288,7 +287,7 @@ static int handle_root_syscall(struct ipipe_domain *ipd, 
struct pt_regs *regs)
 {
        int nr, sysflags, switched, ret, sigs;
        struct xnthread *thread;
-       cobalt_handler handler;
+       cobalt_syshand handler;
        struct task_struct *p;
 
        /*
@@ -730,110 +729,174 @@ static int cobalt_ni(void)
        return -ENOSYS;
 }
 
-#define __syshand__(__name)            ((cobalt_handler)(cobalt_ ## __name))
-#define __COBALT_CALL(__name)          [sc_cobalt_ ## __name] = 
__syshand__(__name)
-#define __COBALT_MODE(__name, __flags) [sc_cobalt_ ## __name] = 
__xn_exec_##__flags
+/*
+ * We have a single syscall table for all ABI models, i.e. 64bit
+ * native + 32bit) or plain 32bit. In the former case, we may want to
+ * support several models with a single build (e.g. ia32 and x32 for
+ * x86_64).
+ *
+ * The syscall table is set up in a single step, based on three
+ * subsequent sources of initializers:
+ *
+ * - first, all syscall entries are defaulted to a placeholder
+ * returning -ENOSYS, as the table may be sparse.
+ *
+ * - then __COBALT_CALL_ENTRY() produces a native call entry
+ * (e.g. pure 64bit call handler for a 64bit architecture), and
+ * optionally a set of 32bit syscall entries offset by an
+ * arch-specific base index defaulting to the native calls, all in the
+ * same syscall table/array. These nitty-gritty details are defined by
+ * asm/xenomai/syscall32.h. 32bit architectures - or 64bit ones for
+ * which we don't support any 32bit ABI model - will simply define
+ * __COBALT_CALL32_ENTRY() as an empty macro.
+ *
+ * - finally, pure 32bit call entries are generated per-architecture,
+ * by including <asm/xenomai/syscall32-table.h>, overriding the
+ * default handlers installed during the previous step.
+ *
+ * For instance, with CONFIG_X86_X32 support enabled in an x86_64
+ * kernel, sc_cobalt_mq_timedreceive would appear twice in the table,
+ * as:
+ *
+ * [sc_cobalt_mq_timedreceive] = cobalt_mq_timedreceive,
+ * ...
+ * [sc_cobalt_mq_timedreceive + __COBALT_X32_BASE] = cobalt32x_mq_timedreceive,
+ *
+ * cobalt32x_mq_timedreceive() would do the required thunking for
+ * dealing with the 32<->64bit conversion of arguments. On the other
+ * hand, sc_cobalt_sched_yield which do not require any thunking would
+ * also appear twice, but both entries would point at the native
+ * syscall implementation:
+ *
+ * [sc_cobalt_sched_yield] = cobalt_sched_yield,
+ * ...
+ * [sc_cobalt_sched_yield + __COBALT_X32_BASE] = cobalt_sched_yield,
+ *
+ * Accordingly, applications targeting the x32 model (-mx32) issue
+ * syscalls in the range [__COBALT_X32_BASE..__COBALT_X32_BASE +
+ * __NR_COBALT_SYSCALLS-1], whilst native (32/64bit) ones issue
+ * syscalls in the range [0..__NR_COBALT_SYSCALLS-1].
+ *
+ * In short, this is an incremental process where the arch-specific
+ * code can override the 32bit syscall entries, pointing at the thunk
+ * routines it may need for handing 32bit calls over their respective
+ * 64bit implementation.
+ *
+ * By convention, there is NO 32bit-specific syscall, which means that
+ * each 32bit syscall defined by a compat ABI interface MUST match a
+ * native (64bit) syscall. This is important as we share the call
+ * modes (i.e. __xn_exec_ bits) between all ABI models.
+ *
+ * --rpm
+ */
+#define __syshand__(__name)            ((cobalt_syshand)(cobalt_ ## __name))
+#define __COBALT_CALL_ENTRY(__name)    [sc_cobalt_ ## __name] = 
__syshand__(__name)    \
+                                       __COBALT_CALL32_ENTRY(__name, 
__syshand__(__name))
+#define __COBALT_MODE(__name, __mode)  [sc_cobalt_ ## __name] = 
__xn_exec_##__mode
 #define __COBALT_NI                    __syshand__(ni)
 
-static const cobalt_handler cobalt_syscalls[] = {
+static const cobalt_syshand cobalt_syscalls[] = {
        [0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI,
-       __COBALT_CALL(thread_create),
-       __COBALT_CALL(thread_getpid),
-       __COBALT_CALL(thread_setschedparam_ex),
-       __COBALT_CALL(thread_getschedparam_ex),
-       __COBALT_CALL(sched_weightprio),
-       __COBALT_CALL(sched_yield),
-       __COBALT_CALL(thread_setmode),
-       __COBALT_CALL(thread_setname),
-       __COBALT_CALL(thread_kill),
-       __COBALT_CALL(thread_getstat),
-       __COBALT_CALL(thread_join),
-       __COBALT_CALL(sem_init),
-       __COBALT_CALL(sem_destroy),
-       __COBALT_CALL(sem_post),
-       __COBALT_CALL(sem_wait),
-       __COBALT_CALL(sem_timedwait),
-       __COBALT_CALL(sem_trywait),
-       __COBALT_CALL(sem_getvalue),
-       __COBALT_CALL(sem_open),
-       __COBALT_CALL(sem_close),
-       __COBALT_CALL(sem_unlink),
-       __COBALT_CALL(sem_broadcast_np),
-       __COBALT_CALL(sem_inquire),
-       __COBALT_CALL(clock_getres),
-       __COBALT_CALL(clock_gettime),
-       __COBALT_CALL(clock_settime),
-       __COBALT_CALL(clock_nanosleep),
-       __COBALT_CALL(mutex_init),
-       __COBALT_CALL(mutex_check_init),
-       __COBALT_CALL(mutex_destroy),
-       __COBALT_CALL(mutex_lock),
-       __COBALT_CALL(mutex_timedlock),
-       __COBALT_CALL(mutex_trylock),
-       __COBALT_CALL(mutex_unlock),
-       __COBALT_CALL(cond_init),
-       __COBALT_CALL(cond_destroy),
-       __COBALT_CALL(cond_wait_prologue),
-       __COBALT_CALL(cond_wait_epilogue),
-       __COBALT_CALL(mq_open),
-       __COBALT_CALL(mq_close),
-       __COBALT_CALL(mq_unlink),
-       __COBALT_CALL(mq_getattr),
-       __COBALT_CALL(mq_setattr),
-       __COBALT_CALL(mq_timedsend),
-       __COBALT_CALL(mq_timedreceive),
-       __COBALT_CALL(mq_notify),
-       __COBALT_CALL(sigwait),
-       __COBALT_CALL(sigwaitinfo),
-       __COBALT_CALL(sigtimedwait),
-       __COBALT_CALL(sigpending),
-       __COBALT_CALL(kill),
-       __COBALT_CALL(sigqueue),
-       __COBALT_CALL(timer_create),
-       __COBALT_CALL(timer_delete),
-       __COBALT_CALL(timer_settime),
-       __COBALT_CALL(timer_gettime),
-       __COBALT_CALL(timer_getoverrun),
-       __COBALT_CALL(timerfd_create),
-       __COBALT_CALL(timerfd_gettime),
-       __COBALT_CALL(timerfd_settime),
-       __COBALT_CALL(select),
-       __COBALT_CALL(sched_minprio),
-       __COBALT_CALL(sched_maxprio),
-       __COBALT_CALL(monitor_init),
-       __COBALT_CALL(monitor_destroy),
-       __COBALT_CALL(monitor_enter),
-       __COBALT_CALL(monitor_wait),
-       __COBALT_CALL(monitor_sync),
-       __COBALT_CALL(monitor_exit),
-       __COBALT_CALL(event_init),
-       __COBALT_CALL(event_destroy),
-       __COBALT_CALL(event_wait),
-       __COBALT_CALL(event_sync),
-       __COBALT_CALL(event_inquire),
-       __COBALT_CALL(sched_setconfig_np),
-       __COBALT_CALL(sched_getconfig_np),
-       __COBALT_CALL(open),
-       __COBALT_CALL(socket),
-       __COBALT_CALL(close),
-       __COBALT_CALL(mmap),
-       __COBALT_CALL(ioctl),
-       __COBALT_CALL(read),
-       __COBALT_CALL(write),
-       __COBALT_CALL(recvmsg),
-       __COBALT_CALL(sendmsg),
-       __COBALT_CALL(migrate),
-       __COBALT_CALL(archcall),
-       __COBALT_CALL(bind),
-       __COBALT_CALL(extend),
-       __COBALT_CALL(info),
-       __COBALT_CALL(trace),
-       __COBALT_CALL(heap_getstat),
-       __COBALT_CALL(get_current),
-       __COBALT_CALL(mayday),
-       __COBALT_CALL(backtrace),
-       __COBALT_CALL(serialdbg),
-       __COBALT_CALL(sysconf),
+       __COBALT_CALL_ENTRY(thread_create),
+       __COBALT_CALL_ENTRY(thread_getpid),
+       __COBALT_CALL_ENTRY(thread_setschedparam_ex),
+       __COBALT_CALL_ENTRY(thread_getschedparam_ex),
+       __COBALT_CALL_ENTRY(sched_weightprio),
+       __COBALT_CALL_ENTRY(sched_yield),
+       __COBALT_CALL_ENTRY(thread_setmode),
+       __COBALT_CALL_ENTRY(thread_setname),
+       __COBALT_CALL_ENTRY(thread_kill),
+       __COBALT_CALL_ENTRY(thread_getstat),
+       __COBALT_CALL_ENTRY(thread_join),
+       __COBALT_CALL_ENTRY(sem_init),
+       __COBALT_CALL_ENTRY(sem_destroy),
+       __COBALT_CALL_ENTRY(sem_post),
+       __COBALT_CALL_ENTRY(sem_wait),
+       __COBALT_CALL_ENTRY(sem_timedwait),
+       __COBALT_CALL_ENTRY(sem_trywait),
+       __COBALT_CALL_ENTRY(sem_getvalue),
+       __COBALT_CALL_ENTRY(sem_open),
+       __COBALT_CALL_ENTRY(sem_close),
+       __COBALT_CALL_ENTRY(sem_unlink),
+       __COBALT_CALL_ENTRY(sem_broadcast_np),
+       __COBALT_CALL_ENTRY(sem_inquire),
+       __COBALT_CALL_ENTRY(clock_getres),
+       __COBALT_CALL_ENTRY(clock_gettime),
+       __COBALT_CALL_ENTRY(clock_settime),
+       __COBALT_CALL_ENTRY(clock_nanosleep),
+       __COBALT_CALL_ENTRY(mutex_init),
+       __COBALT_CALL_ENTRY(mutex_check_init),
+       __COBALT_CALL_ENTRY(mutex_destroy),
+       __COBALT_CALL_ENTRY(mutex_lock),
+       __COBALT_CALL_ENTRY(mutex_timedlock),
+       __COBALT_CALL_ENTRY(mutex_trylock),
+       __COBALT_CALL_ENTRY(mutex_unlock),
+       __COBALT_CALL_ENTRY(cond_init),
+       __COBALT_CALL_ENTRY(cond_destroy),
+       __COBALT_CALL_ENTRY(cond_wait_prologue),
+       __COBALT_CALL_ENTRY(cond_wait_epilogue),
+       __COBALT_CALL_ENTRY(mq_open),
+       __COBALT_CALL_ENTRY(mq_close),
+       __COBALT_CALL_ENTRY(mq_unlink),
+       __COBALT_CALL_ENTRY(mq_getattr),
+       __COBALT_CALL_ENTRY(mq_setattr),
+       __COBALT_CALL_ENTRY(mq_timedsend),
+       __COBALT_CALL_ENTRY(mq_timedreceive),
+       __COBALT_CALL_ENTRY(mq_notify),
+       __COBALT_CALL_ENTRY(sigwait),
+       __COBALT_CALL_ENTRY(sigwaitinfo),
+       __COBALT_CALL_ENTRY(sigtimedwait),
+       __COBALT_CALL_ENTRY(sigpending),
+       __COBALT_CALL_ENTRY(kill),
+       __COBALT_CALL_ENTRY(sigqueue),
+       __COBALT_CALL_ENTRY(timer_create),
+       __COBALT_CALL_ENTRY(timer_delete),
+       __COBALT_CALL_ENTRY(timer_settime),
+       __COBALT_CALL_ENTRY(timer_gettime),
+       __COBALT_CALL_ENTRY(timer_getoverrun),
+       __COBALT_CALL_ENTRY(timerfd_create),
+       __COBALT_CALL_ENTRY(timerfd_gettime),
+       __COBALT_CALL_ENTRY(timerfd_settime),
+       __COBALT_CALL_ENTRY(select),
+       __COBALT_CALL_ENTRY(sched_minprio),
+       __COBALT_CALL_ENTRY(sched_maxprio),
+       __COBALT_CALL_ENTRY(monitor_init),
+       __COBALT_CALL_ENTRY(monitor_destroy),
+       __COBALT_CALL_ENTRY(monitor_enter),
+       __COBALT_CALL_ENTRY(monitor_wait),
+       __COBALT_CALL_ENTRY(monitor_sync),
+       __COBALT_CALL_ENTRY(monitor_exit),
+       __COBALT_CALL_ENTRY(event_init),
+       __COBALT_CALL_ENTRY(event_destroy),
+       __COBALT_CALL_ENTRY(event_wait),
+       __COBALT_CALL_ENTRY(event_sync),
+       __COBALT_CALL_ENTRY(event_inquire),
+       __COBALT_CALL_ENTRY(sched_setconfig_np),
+       __COBALT_CALL_ENTRY(sched_getconfig_np),
+       __COBALT_CALL_ENTRY(open),
+       __COBALT_CALL_ENTRY(socket),
+       __COBALT_CALL_ENTRY(close),
+       __COBALT_CALL_ENTRY(mmap),
+       __COBALT_CALL_ENTRY(ioctl),
+       __COBALT_CALL_ENTRY(read),
+       __COBALT_CALL_ENTRY(write),
+       __COBALT_CALL_ENTRY(recvmsg),
+       __COBALT_CALL_ENTRY(sendmsg),
+       __COBALT_CALL_ENTRY(migrate),
+       __COBALT_CALL_ENTRY(archcall),
+       __COBALT_CALL_ENTRY(bind),
+       __COBALT_CALL_ENTRY(extend),
+       __COBALT_CALL_ENTRY(info),
+       __COBALT_CALL_ENTRY(trace),
+       __COBALT_CALL_ENTRY(heap_getstat),
+       __COBALT_CALL_ENTRY(get_current),
+       __COBALT_CALL_ENTRY(mayday),
+       __COBALT_CALL_ENTRY(backtrace),
+       __COBALT_CALL_ENTRY(serialdbg),
+       __COBALT_CALL_ENTRY(sysconf),
+#ifdef CONFIG_XENO_OPT_SYS3264
+#include <asm/xenomai/syscall32-table.h>
+#endif 
 };
 
 static const int cobalt_sysmodes[] = {
diff --git a/kernel/cobalt/posix/syscall.h b/kernel/cobalt/posix/syscall.h
index 8c41475..9ab686d 100644
--- a/kernel/cobalt/posix/syscall.h
+++ b/kernel/cobalt/posix/syscall.h
@@ -18,10 +18,16 @@
 #ifndef _COBALT_POSIX_SYSCALL_H
 #define _COBALT_POSIX_SYSCALL_H
 
+#include <cobalt/uapi/syscall.h>
+
+/* Regular (native) syscall handler implementation. */
 #define COBALT_SYSCALL(__name, __mode, __type, __args) \
        __typeof__(__type) cobalt_ ## __name __args
 
+/* Regular (native) syscall handler declaration. */
 #define COBALT_SYSCALL_DECL(__name, __type, __args)    \
        __typeof__(__type) cobalt_ ## __name __args
 
+#include <asm/xenomai/syscall32.h>
+
 #endif /* !_COBALT_POSIX_SYSCALL_H */
diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c
new file mode 100644
index 0000000..3b0b71c
--- /dev/null
+++ b/kernel/cobalt/posix/syscall32.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>
+ *
+ * Xenomai is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Xenomai is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#include <linux/types.h>
+#include <linux/err.h>
+#include <linux/compat.h>
+#include <cobalt/uapi/syscall.h>
+#include "internal.h"
+#include "thread.h"
+#include "sched.h"
+#include "mutex.h"
+#include "cond.h"
+#include "mqueue.h"
+#include "sem.h"
+#include "signal.h"
+#include "timer.h"
+#include "monitor.h"
+#include "clock.h"
+#include "event.h"
+#include "timerfd.h"
+#include "io.h"


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

Reply via email to