[Xenomai-git] Philippe Gerum : cobalt/x86: enable 32bit syscall emulation

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

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

cobalt/x86: enable 32bit syscall emulation

---

 kernel/cobalt/arch/x86/Kconfig |5 +-
 .../cobalt/arch/x86/include/asm/xenomai/syscall.h  |8 +-
 .../arch/x86/include/asm/xenomai/syscall32-table.h |   54 ---
 .../arch/x86/include/asm/xenomai/syscall32.h   |  147 ++--
 4 files changed, 180 insertions(+), 34 deletions(-)

diff --git a/kernel/cobalt/arch/x86/Kconfig b/kernel/cobalt/arch/x86/Kconfig
index 72e539a..9adbbf7 100644
--- a/kernel/cobalt/arch/x86/Kconfig
+++ b/kernel/cobalt/arch/x86/Kconfig
@@ -1,9 +1,8 @@
 config XENO_ARCH_FPU
def_bool y
 
-config XENO_ARCH_X32
-def_bool X86_X32
-   select XENO_OPT_SYS3264
+config XENO_ARCH_SYS3264
+def_bool IA32_EMULATION
 
 source kernel/xenomai/Kconfig
 source drivers/xenomai/Kconfig
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
index ddbb3df..5901e4d 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
@@ -42,8 +42,12 @@
 #define __xn_reg_sp(regs) ((regs)-sp)
 
 #define __xn_syscall_p(regs)  (__xn_reg_sys(regs)  __COBALT_SYSCALL_BIT)
-#define __xn_syscall(regs)(__xn_reg_sys(regs)  \
-  ~(__COBALT_SYSCALL_BIT|__COBALT_SYSCALL_MASK))
+#ifdef CONFIG_XENO_ARCH_SYS3264
+#define __xn_syscall(regs)__COBALT_CALL32_SYSNR(__xn_reg_sys(regs) \
+~__COBALT_SYSCALL_BIT)
+#else
+#define __xn_syscall(regs)(__xn_reg_sys(regs)  ~__COBALT_SYSCALL_BIT)
+#endif
 
 static inline void __xn_success_return(struct pt_regs *regs, int v)
 {
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
index b7da23b..1c84ef3 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
@@ -24,22 +24,42 @@
  * table. Only preprocessor stuff and syscall entries here.
  */
 
-#ifdef CONFIG_X86_X32
-
-/*
- * When x32 support is enabled, we need thunks for dealing with
- * 32-64 argument conversion. An additional entry for each
- * __COBALT_CALL_X32 syscall is generated into the table, at a
- * position equal to the original syscall number + __COBALT_X32_BASE
- * as defined in asm/xenomai/syscall32.h.
- */
-
-#define __sysx32__(__name) \
-   ((cobalt_syshand)(cobalt32x_ ## __name))
-
-#define __COBALT_CALL_X32(__name)  \
-   [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __sysx32__(__name),
-
-#endif
+__COBALT_CALL32emu_THUNK(thread_create)
+__COBALT_CALL32emu_THUNK(thread_setschedparam_ex)
+__COBALT_CALL32emu_THUNK(thread_getschedparam_ex)
+__COBALT_CALL32emu_THUNK(sem_open)
+__COBALT_CALL32emu_THUNK(sem_timedwait)
+__COBALT_CALL32emu_THUNK(clock_getres)
+__COBALT_CALL32emu_THUNK(clock_gettime)
+__COBALT_CALL32emu_THUNK(clock_settime)
+__COBALT_CALL32emu_THUNK(clock_nanosleep)
+__COBALT_CALL32emu_THUNK(mutex_timedlock)
+__COBALT_CALL32emu_THUNK(cond_wait_prologue)
+__COBALT_CALL32emu_THUNK(mq_open)
+__COBALT_CALL32emu_THUNK(mq_getattr)
+__COBALT_CALL32emu_THUNK(mq_setattr)
+__COBALT_CALL32emu_THUNK(mq_timedsend)
+__COBALT_CALL32emu_THUNK(mq_timedreceive)
+__COBALT_CALL32emu_THUNK(mq_notify)
+__COBALT_CALL32emu_THUNK(sched_weightprio)
+__COBALT_CALL32emu_THUNK(sched_setconfig_np)
+__COBALT_CALL32emu_THUNK(sched_getconfig_np)
+__COBALT_CALL32emu_THUNK(timer_create)
+__COBALT_CALL32emu_THUNK(timer_settime)
+__COBALT_CALL32emu_THUNK(timer_gettime)
+__COBALT_CALL32emu_THUNK(timerfd_settime)
+__COBALT_CALL32emu_THUNK(timerfd_gettime)
+__COBALT_CALL32emu_THUNK(sigwait)
+__COBALT_CALL32emu_THUNK(sigtimedwait)
+__COBALT_CALL32emu_THUNK(sigwaitinfo)
+__COBALT_CALL32emu_THUNK(sigpending)
+__COBALT_CALL32emu_THUNK(sigqueue)
+__COBALT_CALL32emu_THUNK(monitor_wait)
+__COBALT_CALL32emu_THUNK(event_wait)
+__COBALT_CALL32emu_THUNK(select)
+__COBALT_CALL32emu_THUNK(recvmsg)
+__COBALT_CALL32emu_THUNK(sendmsg)
+__COBALT_CALL32emu_THUNK(mmap)
+__COBALT_CALL32emu_THUNK(backtrace)
 
 #endif /* !_COBALT_X86_ASM_SYSCALL32_TABLE_H */
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
index b83aaf4..e4890a6 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -19,26 +19,50 @@
 #ifndef _COBALT_X86_ASM_SYSCALL32_H
 #define _COBALT_X86_ASM_SYSCALL32_H
 
+#include asm/unistd.h
+
 #ifdef CONFIG_X86_X32
 
-#include linux/compat.h
+#define __COBALT_X32_BASE  128
+
+#define __COBALT_SYSNR32x(__reg)   \
+   

[Xenomai-git] Philippe Gerum : cobalt/x86: enable 32bit syscall emulation

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

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

cobalt/x86: enable 32bit syscall emulation

---

 kernel/cobalt/arch/x86/Kconfig |5 +-
 .../cobalt/arch/x86/include/asm/xenomai/syscall.h  |8 +-
 .../arch/x86/include/asm/xenomai/syscall32-table.h |   54 ---
 .../arch/x86/include/asm/xenomai/syscall32.h   |  147 ++--
 4 files changed, 180 insertions(+), 34 deletions(-)

diff --git a/kernel/cobalt/arch/x86/Kconfig b/kernel/cobalt/arch/x86/Kconfig
index 72e539a..9adbbf7 100644
--- a/kernel/cobalt/arch/x86/Kconfig
+++ b/kernel/cobalt/arch/x86/Kconfig
@@ -1,9 +1,8 @@
 config XENO_ARCH_FPU
def_bool y
 
-config XENO_ARCH_X32
-def_bool X86_X32
-   select XENO_OPT_SYS3264
+config XENO_ARCH_SYS3264
+def_bool IA32_EMULATION
 
 source kernel/xenomai/Kconfig
 source drivers/xenomai/Kconfig
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
index ddbb3df..5901e4d 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
@@ -42,8 +42,12 @@
 #define __xn_reg_sp(regs) ((regs)-sp)
 
 #define __xn_syscall_p(regs)  (__xn_reg_sys(regs)  __COBALT_SYSCALL_BIT)
-#define __xn_syscall(regs)(__xn_reg_sys(regs)  \
-  ~(__COBALT_SYSCALL_BIT|__COBALT_SYSCALL_MASK))
+#ifdef CONFIG_XENO_ARCH_SYS3264
+#define __xn_syscall(regs)__COBALT_CALL32_SYSNR(__xn_reg_sys(regs) \
+~__COBALT_SYSCALL_BIT)
+#else
+#define __xn_syscall(regs)(__xn_reg_sys(regs)  ~__COBALT_SYSCALL_BIT)
+#endif
 
 static inline void __xn_success_return(struct pt_regs *regs, int v)
 {
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
index b7da23b..1c84ef3 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
@@ -24,22 +24,42 @@
  * table. Only preprocessor stuff and syscall entries here.
  */
 
-#ifdef CONFIG_X86_X32
-
-/*
- * When x32 support is enabled, we need thunks for dealing with
- * 32-64 argument conversion. An additional entry for each
- * __COBALT_CALL_X32 syscall is generated into the table, at a
- * position equal to the original syscall number + __COBALT_X32_BASE
- * as defined in asm/xenomai/syscall32.h.
- */
-
-#define __sysx32__(__name) \
-   ((cobalt_syshand)(cobalt32x_ ## __name))
-
-#define __COBALT_CALL_X32(__name)  \
-   [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __sysx32__(__name),
-
-#endif
+__COBALT_CALL32emu_THUNK(thread_create)
+__COBALT_CALL32emu_THUNK(thread_setschedparam_ex)
+__COBALT_CALL32emu_THUNK(thread_getschedparam_ex)
+__COBALT_CALL32emu_THUNK(sem_open)
+__COBALT_CALL32emu_THUNK(sem_timedwait)
+__COBALT_CALL32emu_THUNK(clock_getres)
+__COBALT_CALL32emu_THUNK(clock_gettime)
+__COBALT_CALL32emu_THUNK(clock_settime)
+__COBALT_CALL32emu_THUNK(clock_nanosleep)
+__COBALT_CALL32emu_THUNK(mutex_timedlock)
+__COBALT_CALL32emu_THUNK(cond_wait_prologue)
+__COBALT_CALL32emu_THUNK(mq_open)
+__COBALT_CALL32emu_THUNK(mq_getattr)
+__COBALT_CALL32emu_THUNK(mq_setattr)
+__COBALT_CALL32emu_THUNK(mq_timedsend)
+__COBALT_CALL32emu_THUNK(mq_timedreceive)
+__COBALT_CALL32emu_THUNK(mq_notify)
+__COBALT_CALL32emu_THUNK(sched_weightprio)
+__COBALT_CALL32emu_THUNK(sched_setconfig_np)
+__COBALT_CALL32emu_THUNK(sched_getconfig_np)
+__COBALT_CALL32emu_THUNK(timer_create)
+__COBALT_CALL32emu_THUNK(timer_settime)
+__COBALT_CALL32emu_THUNK(timer_gettime)
+__COBALT_CALL32emu_THUNK(timerfd_settime)
+__COBALT_CALL32emu_THUNK(timerfd_gettime)
+__COBALT_CALL32emu_THUNK(sigwait)
+__COBALT_CALL32emu_THUNK(sigtimedwait)
+__COBALT_CALL32emu_THUNK(sigwaitinfo)
+__COBALT_CALL32emu_THUNK(sigpending)
+__COBALT_CALL32emu_THUNK(sigqueue)
+__COBALT_CALL32emu_THUNK(monitor_wait)
+__COBALT_CALL32emu_THUNK(event_wait)
+__COBALT_CALL32emu_THUNK(select)
+__COBALT_CALL32emu_THUNK(recvmsg)
+__COBALT_CALL32emu_THUNK(sendmsg)
+__COBALT_CALL32emu_THUNK(mmap)
+__COBALT_CALL32emu_THUNK(backtrace)
 
 #endif /* !_COBALT_X86_ASM_SYSCALL32_TABLE_H */
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
index b83aaf4..e4890a6 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -19,26 +19,50 @@
 #ifndef _COBALT_X86_ASM_SYSCALL32_H
 #define _COBALT_X86_ASM_SYSCALL32_H
 
+#include asm/unistd.h
+
 #ifdef CONFIG_X86_X32
 
-#include linux/compat.h
+#define __COBALT_X32_BASE  128
+
+#define __COBALT_SYSNR32x(__reg)   \
+