fls() not available in Linux 2.4
PATCH 1/1 fls() not available in Linux 2.4
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.
asm-generic/wrappers.h +12 -0
@@ -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) \
Quoted 10 lines · Wolfgang Grandegger
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 ?
Signature · 1 line
Gilles Chanteperdrix.
Quoted 6 lines · Gilles Chanteperdrix
Quoted 5 lines · Wolfgang Grandegger
Hello,
the attached patch fixes the following compilation error with Xenomai's head of trunk under Linux 2.4:
Quoted 8 lines
Quoted 5 lines
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.hinstead ofasm-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.
Quoted 13 lines · Wolfgang Grandegger
Quoted 12 lines · Gilles Chanteperdrix
Quoted 10 lines · Wolfgang Grandegger
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'
Quoted 6 lines
Quoted 2 lines
Should not this implementation go to
asm-powerpc/wrappers.hinstead ofasm-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.
Signature · 1 line
Gilles Chanteperdrix
Quoted 10 lines · Wolfgang Grandegger
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.
Signature · 1 line
Gilles Chanteperdrix.