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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Sep  2 19:25:10 2014 +0200

cobalt/x86: enable x32 (WIP)

---

 kernel/cobalt/arch/x86/Kconfig                     |    4 ++
 .../cobalt/arch/x86/include/asm/xenomai/syscall.h  |   12 +++---
 .../arch/x86/include/asm/xenomai/syscall32-table.h |   45 ++++++++++++++++++++
 .../arch/x86/include/asm/xenomai/syscall32.h       |    5 +++
 .../arch/x86/include/asm/xenomai/uapi/syscall.h    |   10 ++++-
 5 files changed, 67 insertions(+), 9 deletions(-)

diff --git a/kernel/cobalt/arch/x86/Kconfig b/kernel/cobalt/arch/x86/Kconfig
index c6abcf9..21587b0 100644
--- a/kernel/cobalt/arch/x86/Kconfig
+++ b/kernel/cobalt/arch/x86/Kconfig
@@ -4,5 +4,9 @@ config XENO_HW_FPU
 config XENO_HW_AUTOTUNE
        def_bool y
 
+config XENO_HW_X32
+        def_bool X86_X32
+       select XENO_OPT_SYS3264
+
 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 beb5674..ddbb3df 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001,2002,2003,2007 Philippe Gerum <r...@xenomai.org>.
+ * Copyright (C) 2001-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
@@ -16,7 +16,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-
 #ifndef _COBALT_X86_ASM_SYSCALL_H
 #define _COBALT_X86_ASM_SYSCALL_H
 
@@ -36,16 +35,15 @@
 #define __xn_reg_arg1(regs)   ((regs)->di)
 #define __xn_reg_arg2(regs)   ((regs)->si)
 #define __xn_reg_arg3(regs)   ((regs)->dx)
-#define __xn_reg_arg4(regs)   ((regs)->r10) /* entry.S convention here. */
+#define __xn_reg_arg4(regs)   ((regs)->r10)
 #define __xn_reg_arg5(regs)   ((regs)->r8)
 #endif /* x86_64 */
 #define __xn_reg_pc(regs)     ((regs)->ip)
 #define __xn_reg_sp(regs)     ((regs)->sp)
 
-#define __xn_syscall_p(regs)  ((__xn_reg_sys(regs) & 0x7fff) == 
cobalt_syscall_tag)
-#define __xn_syscall(regs)     ((__xn_reg_sys(regs) >> 24) & 0xff)
-
-#define __xn_syslinux_p(regs, nr)  (__xn_reg_sys(regs) == (nr))
+#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))
 
 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
new file mode 100644
index 0000000..b7da23b
--- /dev/null
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h
@@ -0,0 +1,45 @@
+/*
+ * 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_TABLE_H
+#define _COBALT_X86_ASM_SYSCALL32_TABLE_H
+
+/*
+ * CAUTION: This file is read verbatim into the main syscall
+ * 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
+
+#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 7d804e4..b83aaf4 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -24,6 +24,7 @@
 #include <linux/compat.h>
 
 #define __COBALT_X32_BASE      128
+#define __COBALT_SYSCALL_MASK  __X32_SYSCALL_BIT
 
 #if __NR_COBALT_SYSCALLS >= __COBALT_X32_BASE
 #error "__NR_COBALT_SYSCALLS >= __COBALT_X32_BASE"
@@ -51,4 +52,8 @@
 
 #endif /* !CONFIG_X86_X32 */
 
+#ifndef __COBALT_SYSCALL_MASK
+#define __COBALT_SYSCALL_MASK  0
+#endif
+
 #endif /* !_COBALT_X86_ASM_SYSCALL32_H */
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/syscall.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/syscall.h
index 1012b1b..aa9936d 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/syscall.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/uapi/syscall.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001,2002,2003,2007 Philippe Gerum <r...@xenomai.org>.
+ * Copyright (C) 2001-2014 Philippe Gerum <r...@xenomai.org>.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,6 +18,12 @@
 #ifndef _COBALT_X86_ASM_UAPI_SYSCALL_H
 #define _COBALT_X86_ASM_UAPI_SYSCALL_H
 
-#define __xn_syscode(op)       ((op << 24)|(cobalt_syscall_tag & 0x7fff))
+#ifdef __ILP32__
+#define __xn_syscall_base  __COBALT_X32_BASE
+#else
+#define __xn_syscall_base  0
+#endif
+
+#define __xn_syscode(__nr)     (__COBALT_SYSCALL_BIT | (__nr + 
__xn_syscall_base))
 
 #endif /* !_COBALT_X86_ASM_UAPI_SYSCALL_H */


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

Reply via email to