* [Xenomai-core] [PATCH] fls() not available in Linux 2.4
@ 2007-08-16 7:42 Wolfgang Grandegger
2007-08-16 7:51 ` Gilles Chanteperdrix
2007-08-16 11:16 ` Gilles Chanteperdrix
0 siblings, 2 replies; 5+ messages in thread
From: Wolfgang Grandegger @ 2007-08-16 7:42 UTC (permalink / raw)
To: xenomai-core
[-- Attachment #1: Type: text/plain, Size: 460 bytes --]
Hello,
the attached patch fixes the following compilation error with Xenomai's
head of trunk under Linux 2.4:
kernel/kernel.o(.text+0x135a4): In function `__rthal_generic_full_divmod64':
/temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
undefined reference to `fls'
kernel/kernel.o(.text+0x135b4):/temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
undefined reference to `fls'
Wolfgang.
[-- Attachment #2: xenomai-fls.patch --]
[-- Type: text/x-patch, Size: 710 bytes --]
Index: include/asm-generic/wrappers.h
===================================================================
--- include/asm-generic/wrappers.h (revision 2922)
+++ include/asm-generic/wrappers.h (working copy)
@@ -183,6 +183,18 @@ void show_stack(struct task_struct *task
#define __deprecated __attribute__((deprecated))
#endif
+/*
+ * fls: find last (most-significant) bit set.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+static __inline__ int fls(unsigned int x)
+{
+ int lz;
+
+ asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
+ return 32 - lz;
+}
+
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) */
#define compat_module_param_array(name, type, count, perm) \
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-core] [PATCH] fls() not available in Linux 2.4
2007-08-16 7:42 [Xenomai-core] [PATCH] fls() not available in Linux 2.4 Wolfgang Grandegger
@ 2007-08-16 7:51 ` Gilles Chanteperdrix
2007-08-16 8:12 ` Wolfgang Grandegger
2007-08-16 11:16 ` Gilles Chanteperdrix
1 sibling, 1 reply; 5+ messages in thread
From: Gilles Chanteperdrix @ 2007-08-16 7:51 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: xenomai-core
Wolfgang Grandegger wrote:
> Hello,
>
> the attached patch fixes the following compilation error with Xenomai's
> head of trunk under Linux 2.4:
>
> kernel/kernel.o(.text+0x135a4): In function `__rthal_generic_full_divmod64':
> /temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> undefined reference to `fls'
> kernel/kernel.o(.text+0x135b4):/temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> undefined reference to `fls'
Should not this implementation go to asm-powerpc/wrappers.h instead of
asm-generic/wrappers.h ?
--
Gilles Chanteperdrix.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-core] [PATCH] fls() not available in Linux 2.4
2007-08-16 7:51 ` Gilles Chanteperdrix
@ 2007-08-16 8:12 ` Wolfgang Grandegger
2007-08-16 8:22 ` Gilles Chanteperdrix
0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Grandegger @ 2007-08-16 8:12 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai-core
Gilles Chanteperdrix wrote:
> Wolfgang Grandegger wrote:
> > Hello,
> >
> > the attached patch fixes the following compilation error with Xenomai's
> > head of trunk under Linux 2.4:
> >
> > kernel/kernel.o(.text+0x135a4): In function `__rthal_generic_full_divmod64':
> > /temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> > undefined reference to `fls'
> > kernel/kernel.o(.text+0x135b4):/temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> > undefined reference to `fls'
>
> Should not this implementation go to asm-powerpc/wrappers.h instead of
> asm-generic/wrappers.h ?
Ah, yes, of course, because it uses PowerPC assembler. But it might be
missing for other archs as well, e.g. I did not find it for i386 in the
DENX Linux 2.4.25 tree.
Wolfgang.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-core] [PATCH] fls() not available in Linux 2.4
2007-08-16 8:12 ` Wolfgang Grandegger
@ 2007-08-16 8:22 ` Gilles Chanteperdrix
0 siblings, 0 replies; 5+ messages in thread
From: Gilles Chanteperdrix @ 2007-08-16 8:22 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: xenomai-core
On 8/16/07, Wolfgang Grandegger <wg@domain.hid> wrote:
> Gilles Chanteperdrix wrote:
> > Wolfgang Grandegger wrote:
> > > Hello,
> > >
> > > the attached patch fixes the following compilation error with Xenomai's
> > > head of trunk under Linux 2.4:
> > >
> > > kernel/kernel.o(.text+0x135a4): In function `__rthal_generic_full_divmod64':
> > > /temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> > > undefined reference to `fls'
> > > kernel/kernel.o(.text+0x135b4):/temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> > > undefined reference to `fls'
> >
> > Should not this implementation go to asm-powerpc/wrappers.h instead of
> > asm-generic/wrappers.h ?
>
> Ah, yes, of course, because it uses PowerPC assembler. But it might be
> missing for other archs as well, e.g. I did not find it for i386 in the
> DENX Linux 2.4.25 tree.
We will add it to asm-i386/wrappers.h as well then.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-core] [PATCH] fls() not available in Linux 2.4
2007-08-16 7:42 [Xenomai-core] [PATCH] fls() not available in Linux 2.4 Wolfgang Grandegger
2007-08-16 7:51 ` Gilles Chanteperdrix
@ 2007-08-16 11:16 ` Gilles Chanteperdrix
1 sibling, 0 replies; 5+ messages in thread
From: Gilles Chanteperdrix @ 2007-08-16 11:16 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: xenomai-core
Wolfgang Grandegger wrote:
> Hello,
>
> the attached patch fixes the following compilation error with Xenomai's
> head of trunk under Linux 2.4:
>
> kernel/kernel.o(.text+0x135a4): In function `__rthal_generic_full_divmod64':
> /temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> undefined reference to `fls'
> kernel/kernel.o(.text+0x135b4):/temp/rtcan/devel/linuxppc_2_4_devel-xenomai/kernel/xenomai/arch/generic/hal.c:918:
> undefined reference to `fls'
Should be fixed now, thanks.
--
Gilles Chanteperdrix.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-16 11:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16 7:42 [Xenomai-core] [PATCH] fls() not available in Linux 2.4 Wolfgang Grandegger
2007-08-16 7:51 ` Gilles Chanteperdrix
2007-08-16 8:12 ` Wolfgang Grandegger
2007-08-16 8:22 ` Gilles Chanteperdrix
2007-08-16 11:16 ` 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.