Support EABI enabled kernels on ARM
PATCH 1/1 Support EABI enabled kernels on ARM
Hi,
The attached patch adds an option to make Xenomai userspace issue EABI syscalls. This is needed to make Xenomai work with kernels compiled with CONFIG_EABI.
Note that due to a change in syscall handling when the EABI layer was added in the kernel, this patch is needed for all EABI enabled kernels, even if the CONFIG_OABI_COMPAT compatibility layer has been enabled.
All sensible combinations should be supported: old ABI userspace with old ABI kernel, old ABI userspace with CONFIG_OABI_COMPAT kernels, EABI userspace with EABI kernels. The other combinations will fail with a SIGILL signal.
Don't forget to run 'scripts/bootstrap' after applying this patch...
asm-arm/syscall.h +23 -5
@@ -24,11 +24,12 @@#define _XENO_ASM_ARM_SYSCALL_H#include <asm-generic/xenomai/syscall.h> +#include <asm/xenomai/features.h> #define __xn_mux_code (shifted_id,op) ((op << 24)|shifted_id|(__xn_sys_mux & 0xffff))#define __xn_mux_shifted_id (id) ((id << 16) & 0xff0000) -#define XENO_ARM_SYSCALL 0x009F0042/* carefully chosen... */ +#define XENO_ARM_SYSCALL 0x000F0042/* carefully chosen... */ #ifdef __KERNEL__
@@ -46,7 +47,13 @@#define __xn_reg_arg4 (regs) ((regs)->ARM_r4)#define __xn_reg_arg5 (regs) ((regs)->ARM_r5) -#define __xn_reg_mux_p (regs) ((regs)->ARM_r7 == XENO_ARM_SYSCALL) +/* In OABI_COMPAT mode, handle both OABI and EABI userspace syscalls */ +#ifdef CONFIG_OABI_COMPAT +#define __xn_reg_mux_p (regs) ( ((regs)->ARM_r7 == __NR_OABI_SYSCALL_BASE + XENO_ARM_SYSCALL) || \ + ((regs)->ARM_r7 == __NR_SYSCALL_BASE + XENO_ARM_SYSCALL) ) +#else +#define __xn_reg_mux_p (regs) ((regs)->ARM_r7 == __NR_SYSCALL_BASE + XENO_ARM_SYSCALL) +#endif #define __xn_mux_id (regs) ((__xn_reg_mux(regs) >> 16) & 0xff)#define __xn_mux_op (regs) ((__xn_reg_mux(regs) >> 24) & 0xff)
@@ -134,17 +141,28 @@#define __sys2 (x) #x#define __sys1 (x) __sys2(x) +#ifdef CONFIG_XENO_ARM_EABI +#define __SYS_REG register unsigned long __r7 __asm__ ("r7") = XENO_ARM_SYSCALL; +#define __SYS_REG_LIST ,"r" (__r7) +#define __syscall "swi\t0" +#else +#define __SYS_REG +#define __SYS_REG_LIST +#define __syscall "swi\t" __sys1(XENO_ARM_SYSCALL) "" +#endif + #define XENOMAI_DO_SYSCALL(nr, shifted_id, op, args...) \ ({ \ unsigned long __res; \ register unsigned long __res_r0 __asm__ ("r0"); \ ASM_INDECL_##nr; \ + __SYS_REG; \ \ LOADARGS_##nr(__xn_mux_code(shifted_id,op), args); \ - __asm__ __volatile__ ( \ -" swi " __sys1(XENO_ARM_SYSCALL) \ + __asm__ __volatile__ ( \ + __syscall \ : "=r" (__res_r0) \ - : ASM_INPUT_##nr \ + : ASM_INPUT_##nr __SYS_REG_LIST \ : "memory"); \ __res = __res_r0; \ (int) __res; \
asm-arm/features.h +12 -3
@@ -30,12 +30,17 @@#define CONFIG_XENO_ARM_SA1000 1#endif +#ifdef CONFIG_AEABI +#define CONFIG_XENO_ARM_EABI 1 +#endif +#else /* !__KERNEL__ */ #define __LINUX_ARM_ARCH__ CONFIG_XENO_ARM_ARCH#endif /* __KERNEL__ */ #define __xn_feat_arm_atomic_xchg 0x00000001#define __xn_feat_arm_atomic_atomic 0x00000002 +#define __xn_feat_arm_eabi 0x00000004/* The ABI revision level we use on this arch. */ #define XENOMAI_ABI_REV 1UL
@@ -53,10 +58,12 @@#endif #define __xn_feat_arm_atomic_atomic_mask 0#endif +#define __xn_feat_arm_eabi_mask __xn_feat_arm_eabi -#define XENOMAI_FEAT_DEP ( __xn_feat_generic_mask | \ - __xn_feat_arm_atomic_xchg_mask | \ - __xn_feat_arm_atomic_atomic_mask) +#define XENOMAI_FEAT_DEP ( __xn_feat_generic_mask | \ + __xn_feat_arm_atomic_xchg_mask | \ + __xn_feat_arm_atomic_atomic_mask | \ + __xn_feat_arm_eabi_mask )#define XENOMAI_FEAT_MAN 0
@@ -72,6 +79,8 @@return "sa1100" ;case __xn_feat_arm_atomic_atomic:return "v6" ; +case __xn_feat_arm_eabi: +return "eabi" ;default :return get_generic_feature_label (feature); }
configure.in +10 -0
@@ -159,6 +159,7 @@ AC_MSG_CHECKING(for ARM architecture version) CONFIG_XENO_ARM_ARCH=4 CONFIG_XENO_ARM_SA1100= + CONFIX_XENO_ARM_EABI= AC_ARG_ENABLE(arm-arch, AS_HELP_STRING([--enable-arm-arch=<version>], [Select ARM architecture version]), [
@@ -178,6 +179,14 @@ *) unset CONFIG_XENO_ARM_SA1100 ;; esac]) AC_MSG_RESULT(${CONFIG_XENO_ARM_SA1100:-no}) + AC_MSG_CHECKING(for ARM EABI interface) + AC_ARG_ENABLE(arm-eabi, + AS_HELP_STRING([--enable-arm-eabi], [Enable ARM EABI interface]), + [case "$enableval" in + y | yes) CONFIG_XENO_ARM_EABI=y ;; + *) unset CONFIG_XENO_ARM_EABI ;; + esac]) + AC_MSG_RESULT(${CONFIG_XENO_ARM_EABI:-no}) fi dnl Flags for building Linux in Xenomai build tree.
@@ -418,6 +427,7 @@ test x$CONFIG_X86_TSC = xy && AC_DEFINE(CONFIG_X86_TSC,1,[config]) test -n "$CONFIG_XENO_ARM_ARCH" && AC_DEFINE_UNQUOTED(CONFIG_XENO_ARM_ARCH,$CONFIG_XENO_ARM_ARCH,[config]) test x$CONFIG_XENO_ARM_SA1100 = xy && AC_DEFINE(CONFIG_XENO_ARM_SA1100,1,[config]) +test x$CONFIG_XENO_ARM_EABI = xy && AC_DEFINE(CONFIG_XENO_ARM_EABI,1,[config]) dnl CAUTION: We need to have the CONFIG_XENO_XX symbols always dnl defined when the configuration header is read, but we want the
README.INSTALL +2 -0
@@ -164,6 +164,8 @@ --enable-arm-sa1100 Enable SA1100 specific strong,disabled workarounds +--enable-arm-eabi Enable ARM EABI interface weak,disabled + (*) Each option enabled by default can be forcibly disabled by passing --disable-<option> to the configure script.
Signature · 1 line
Stelian Pop <[email protected]>
Gilles Chanteperdrix
AppliedQuoted 10 lines · Stelian Pop
Hi,
The attached patch adds an option to make Xenomai userspace issue EABI syscalls. This is needed to make Xenomai work with kernels compiled with
CONFIG_EABI.Note that due to a change in syscall handling when the EABI layer was added in the kernel, this patch is needed for all EABI enabled kernels, even if the
CONFIG_OABI_COMPATcompatibility layer has been enabled.
Quoted 6 lines
All sensible combinations should be supported: old ABI userspace with old ABI kernel, old ABI userspace with
CONFIG_OABI_COMPATkernels, EABI userspace with EABI kernels. The other combinations will fail with a SIGILL signal.Don't forget to run '
scripts/bootstrap' after applying this patch...
Applied, thanks. And by the way, I am running Debian Etch, and its version of autotools seems to complain that we do not use datarootdir in xeno-config.in...
Signature · 1 line
Gilles Chanteperdrix.
Hi Gilles
Quoted 3 lines · Gilles Chanteperdrix
And by the way, I am running Debian Etch, and its
version of autotools seems to complain that we do not use datarootdir in xeno-config.in...
Attached, a trivial patch to fix the datarootdir warning.
Regards, Paul.
xeno-config.in +2 -1
@@ -4,6 +4,7 @@ staging=${DESTDIR} prefix="@prefix@" exec_prefix="@exec_prefix@" libdir="@libdir@" +datarootdir="@datarootdir@" datadir="@datadir@" pkgdatadir="${datadir}/@PACKAGE@" includedir="@includedir@"
@@ -20,7 +21,7 @@ XENO_POSIX_WRAPPERS="${staging}${libdir} XENO_POSIX_FAST_WRAPPING="@LD_FILE_OPTION@" XENO_LIBRARY_DIR="${staging}${libdir}" -unset prefix exec_prefix libdir datadir pkgdatadir includedir +unset prefix exec_prefix libdir datadir datarootdir pkgdatadir includedir usage () {
Quoted 4 lines · Paul
Hi Gilles
On Monday 16 April 2007 23:36, Gilles Chanteperdrix wrote:
Quoted 8 lines
Quoted 3 lines
And by the way, I am running Debian Etch, and its
version of autotools seems to complain that we do not use datarootdir in xeno-config.in...Attached, a trivial patch to fix the datarootdir warning.
Regards, Paul.
Indeed it fixes the warning. Applied, thanks.
Signature · 1 line
Gilles Chanteperdrix.
Quoted 8 lines · Gilles Chanteperdrix
Quoted 6 lines · Stelian Pop
Hi,
The attached patch adds an option to make Xenomai userspace issue EABI syscalls. This is needed to make Xenomai work with kernels compiled with
CONFIG_EABI.Applied, thanks.
Thanks.
Quoted 3 lines
And by the way, I am running Debian Etch, and its
version of autotools seems to complain that we do not use datarootdir in xeno-config.in...
Hmm, things are going well on an Ubuntu Egdy here, but I suppose the next Ubuntu version (7.04 or Feisty Fawn, due in 3 days) will have almost the same package versions as Debian Etch...
Signature · 1 line
Stelian Pop <[email protected]>
Quoted 10 lines · Stelian Pop
Hi,
The attached patch adds an option to make Xenomai userspace issue EABI syscalls. This is needed to make Xenomai work with kernels compiled with
CONFIG_EABI.Note that due to a change in syscall handling when the EABI layer was added in the kernel, this patch is needed for all EABI enabled kernels, even if the
CONFIG_OABI_COMPATcompatibility layer has been enabled.
Quoted 8 lines
All sensible combinations should be supported: old ABI userspace with old ABI kernel, old ABI userspace with
CONFIG_OABI_COMPATkernels, EABI userspace with EABI kernels. The other combinations will fail with a SIGILL signal.Don't forget to run '
scripts/bootstrap' after applying this patch...Signed-off-by Stelian Pop <[email protected]>
I get a problem with this patch: I am in the no EABI case in user-space and kernel-space, and when starting latency, I get an "Illegal instruction" message. If I revert this patch, latency starts correctly. Any idea ?
Signature · 1 line
Gilles Chanteperdrix.
Quoted 11 lines · Gilles Chanteperdrix
Quoted 6 lines · Stelian Pop
Hi,
The attached patch adds an option to make Xenomai userspace issue EABI syscalls. This is needed to make Xenomai work with kernels compiled with
CONFIG_EABI.I get a problem with this patch: I am in the no EABI case in user-space and kernel-space, and when starting latency, I get an "Illegal instruction" message. If I revert this patch, latency starts correctly. Any idea ?
Hmm, I might have screwed up here. A quick looking points me to this change:
+#define __SYS_REG
+#define __SYS_REG_LIST
+#define __syscall "swi\t" __sys1(XENO_ARM_SYSCALL) ""
Does replacing XENO_ARM_SYSCALL with (0x00900000 + XENO_ARM_SYSCALL) fixes it ?
I may be able to mount a test platform later today if this needs further debugging...
Signature · 1 line
Stelian Pop <[email protected]>
Quoted 20 lines · Stelian Pop
Quoted 11 lines · Gilles Chanteperdrix
Quoted 6 lines · Stelian Pop
Hi,
The attached patch adds an option to make Xenomai userspace issue EABI syscalls. This is needed to make Xenomai work with kernels compiled with
CONFIG_EABI.I get a problem with this patch: I am in the no EABI case in user-space and kernel-space, and when starting latency, I get an "Illegal instruction" message. If I revert this patch, latency starts correctly. Any idea ?
Hmm, I might have screwed up here. A quick looking points me to this change:
asm-arm/syscall.h +3
-0+#define __SYS_REG +#define __SYS_REG_LIST +#define __syscall "swi\t" __sys1(XENO_ARM_SYSCALL) ""
Quoted 5 lines
Does replacing
XENO_ARM_SYSCALLwith (0x00900000+XENO_ARM_SYSCALL) fixes it ?I may be able to mount a test platform later today if this needs further debugging...
I have finally managed to get my old-ABI toolchain to work and can confirm that the modification above fixes the problem.
The whole section of include/asm-arm/syscall.h must read:
#ifdef CONFIG_XENO_ARM_EABI
#define __SYS_REG register unsigned long __r7 __asm__ ("r7") = XENO_ARM_SYSCALL;#define __SYS_REG_LIST ,"r" (__r7) #define __syscall "swi\t0"
#else
#define __SYS_REG
#define __SYS_REG_LIST
#define __NR_OABI_SYSCALL_BASE 0x900000
#define __syscall "swi\t" __sys1(__NR_OABI_SYSCALL_BASE + XENO_ARM_SYSCALL) ""
#endif
Sorry for the annoyance.
Signature · 1 line
Stelian Pop <[email protected]>
Quoted 42 lines · Stelian Pop
Le jeudi 19 avril 2007 ~ 08:38 +0200, Stelian Pop a ~crit :
Quoted 20 lines
Le jeudi 19 avril 2007 ~ 01:35 +0200, Gilles Chanteperdrix a ~crit :
Quoted 11 lines
Quoted 6 lines · Stelian Pop
Hi,
The attached patch adds an option to make Xenomai userspace issue EABI syscalls. This is needed to make Xenomai work with kernels compiled with
CONFIG_EABI.I get a problem with this patch: I am in the no EABI case in user-space and kernel-space, and when starting latency, I get an "Illegal instruction" message. If I revert this patch, latency starts correctly. Any idea ?
Hmm, I might have screwed up here. A quick looking points me to this change:
asm-arm/syscall.h +3
-0+#define __SYS_REG +#define __SYS_REG_LIST +#define __syscall "swi\t" __sys1(XENO_ARM_SYSCALL) ""Quoted 5 lines
Does replacing
XENO_ARM_SYSCALLwith (0x00900000+XENO_ARM_SYSCALL) fixes it ?I may be able to mount a test platform later today if this needs further debugging...
I have finally managed to get my old-ABI toolchain to work and can confirm that the modification above fixes the problem.
The whole section of
include/asm-arm/syscall.hmust read:#ifdef
CONFIG_XENO_ARM_EABI
#define__SYS_REGregister unsigned long__r7__asm__("r7") = XENO_ARM_SYSCALL;#define__SYS_REG_LIST,"r" (__r7) #define__syscall"swi\t0"
#else
#define__SYS_REG
#define__SYS_REG_LIST
#define__NR_OABI_SYSCALL_BASE0x900000
#define__syscall"swi\t"__sys1(__NR_OABI_SYSCALL_BASE + XENO_ARM_SYSCALL)""
#endif
Quoted 1 line
Sorry for the annoyance.
Yep, that was it, thanks.
Signature · 1 line
Gilles Chanteperdrix.