All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
@ 2007-04-14 21:16 Stelian Pop
  2007-04-16 22:36 ` Gilles Chanteperdrix
  2007-04-18 23:35 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 9+ messages in thread
From: Stelian Pop @ 2007-04-14 21:16 UTC (permalink / raw)
  To: xenomai

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...

Signed-off-by: Stelian Pop <stelian@domain.hid>

Index: include/asm-arm/syscall.h
===================================================================
--- include/asm-arm/syscall.h	(révision 2385)
+++ include/asm-arm/syscall.h	(copie de travail)
@@ -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;						\
Index: include/asm-arm/features.h
===================================================================
--- include/asm-arm/features.h	(révision 2385)
+++ include/asm-arm/features.h	(copie de travail)
@@ -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);
     }
Index: configure.in
===================================================================
--- configure.in	(révision 2385)
+++ configure.in	(copie de travail)
@@ -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
Index: README.INSTALL
===================================================================
--- README.INSTALL	(révision 2385)
+++ README.INSTALL	(copie de travail)
@@ -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.
 

-- 
Stelian Pop <stelian@domain.hid>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-14 21:16 [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM Stelian Pop
@ 2007-04-16 22:36 ` Gilles Chanteperdrix
  2007-04-16 22:56   ` Paul
  2007-04-17  8:01   ` Stelian Pop
  2007-04-18 23:35 ` Gilles Chanteperdrix
  1 sibling, 2 replies; 9+ messages in thread
From: Gilles Chanteperdrix @ 2007-04-16 22:36 UTC (permalink / raw)
  To: Stelian Pop; +Cc: xenomai

Stelian Pop wrote:
 > 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...

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... 

-- 


					    Gilles Chanteperdrix.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-16 22:36 ` Gilles Chanteperdrix
@ 2007-04-16 22:56   ` Paul
  2007-04-17 20:03     ` Gilles Chanteperdrix
  2007-04-17  8:01   ` Stelian Pop
  1 sibling, 1 reply; 9+ messages in thread
From: Paul @ 2007-04-16 22:56 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 297 bytes --]


Hi Gilles

On Monday 16 April 2007 23:36, Gilles Chanteperdrix wrote:
> 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.




[-- Attachment #2: datarootdir_fix.patch --]
[-- Type: text/x-diff, Size: 696 bytes --]

Index: scripts/xeno-config.in
===================================================================
--- scripts/xeno-config.in	(revision 2393)
+++ scripts/xeno-config.in	(working copy)
@@ -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 ()
 {

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-16 22:36 ` Gilles Chanteperdrix
  2007-04-16 22:56   ` Paul
@ 2007-04-17  8:01   ` Stelian Pop
  1 sibling, 0 replies; 9+ messages in thread
From: Stelian Pop @ 2007-04-17  8:01 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Le mardi 17 avril 2007 à 00:36 +0200, Gilles Chanteperdrix a écrit :
> Stelian Pop wrote:
>  > 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.

>  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...

-- 
Stelian Pop <stelian@domain.hid>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-16 22:56   ` Paul
@ 2007-04-17 20:03     ` Gilles Chanteperdrix
  0 siblings, 0 replies; 9+ messages in thread
From: Gilles Chanteperdrix @ 2007-04-17 20:03 UTC (permalink / raw)
  To: Paul; +Cc: xenomai

Paul wrote:
 > 
 > Hi Gilles
 > 
 > On Monday 16 April 2007 23:36, Gilles Chanteperdrix wrote:
 > > 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.

-- 


					    Gilles Chanteperdrix.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-14 21:16 [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM Stelian Pop
  2007-04-16 22:36 ` Gilles Chanteperdrix
@ 2007-04-18 23:35 ` Gilles Chanteperdrix
  2007-04-19  6:38   ` Stelian Pop
  1 sibling, 1 reply; 9+ messages in thread
From: Gilles Chanteperdrix @ 2007-04-18 23:35 UTC (permalink / raw)
  To: Stelian Pop; +Cc: xenomai

Stelian Pop wrote:
 > 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...
 > 
 > Signed-off-by: Stelian Pop <stelian@domain.hid>

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 ?

-- 


					    Gilles Chanteperdrix.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-18 23:35 ` Gilles Chanteperdrix
@ 2007-04-19  6:38   ` Stelian Pop
  2007-04-19 15:53     ` Stelian Pop
  0 siblings, 1 reply; 9+ messages in thread
From: Stelian Pop @ 2007-04-19  6:38 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Le jeudi 19 avril 2007 à 01:35 +0200, Gilles Chanteperdrix a écrit :
> Stelian Pop wrote:
>  > 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...

-- 
Stelian Pop <stelian@domain.hid>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-19  6:38   ` Stelian Pop
@ 2007-04-19 15:53     ` Stelian Pop
  2007-04-20 21:00       ` Gilles Chanteperdrix
  0 siblings, 1 reply; 9+ messages in thread
From: Stelian Pop @ 2007-04-19 15:53 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Le jeudi 19 avril 2007 à 08:38 +0200, Stelian Pop a écrit :
> Le jeudi 19 avril 2007 à 01:35 +0200, Gilles Chanteperdrix a écrit :
> > Stelian Pop wrote:
> >  > 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...

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.

-- 
Stelian Pop <stelian@domain.hid>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM
  2007-04-19 15:53     ` Stelian Pop
@ 2007-04-20 21:00       ` Gilles Chanteperdrix
  0 siblings, 0 replies; 9+ messages in thread
From: Gilles Chanteperdrix @ 2007-04-20 21:00 UTC (permalink / raw)
  To: Stelian Pop; +Cc: xenomai

Stelian Pop wrote:
 > Le jeudi 19 avril 2007 ~ 08:38 +0200, Stelian Pop a ~crit :
 > > Le jeudi 19 avril 2007 ~ 01:35 +0200, Gilles Chanteperdrix a ~crit :
 > > > Stelian Pop wrote:
 > > >  > 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...
 > 
 > 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.

Yep, that was it, thanks.

-- 


					    Gilles Chanteperdrix.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-04-20 21:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-14 21:16 [Xenomai-core] [PATCH] Support EABI enabled kernels on ARM Stelian Pop
2007-04-16 22:36 ` Gilles Chanteperdrix
2007-04-16 22:56   ` Paul
2007-04-17 20:03     ` Gilles Chanteperdrix
2007-04-17  8:01   ` Stelian Pop
2007-04-18 23:35 ` Gilles Chanteperdrix
2007-04-19  6:38   ` Stelian Pop
2007-04-19 15:53     ` Stelian Pop
2007-04-20 21:00       ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.