lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 3 Jan 2009 16:31:46 +1030
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>
Cc:	Mike Travis <travis@....com>, Chris Zankel <chris@...kel.net>,
	David Howells <dhowells@...hat.com>,
	Koichi Yasutake <yasutake.koichi@...panasonic.com>,
	linux-am33-list@...hat.com,
	Hirokazu Takata <takata@...ux-m32r.org>,
	linux-m32r@...linux-m32r.org,
	Yoshinori Sato <ysato@...rs.sourceforge.jp>
Subject: Re: git-pull request for tip/cpus4096

On Saturday 03 January 2009 04:39:42 Ingo Molnar wrote:
> these architectures have no __fls() implementation ...
...
>  arch/cris           : 0
>  arch/frv            : 0
>  arch/h8300          : 0
>  arch/m32r           : 0
>  arch/m68k           : 0
>  arch/mn10300        : 0
>  arch/um             : 0
>  arch/xtensa         : 0

These are the non-linux-next archs.

I've already patched m68k (but it's in include/asm-m68k) and um doesn't
need it.  

Fixes are below, and pushed into my cpumask git tree.

Thanks,
Rusty.

commit 5ece5c5192d065c229da01e7b347c1d3877b59fa
Author: Rusty Russell <rusty@...tcorp.com.au>
Date:   Sat Jan 3 16:21:08 2009 +1030

    xtensa: define __fls
    
    Like fls, but can't be handed 0 and returns the bit number.
    
    Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>

diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index 23261e8..6c39303 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -82,6 +82,16 @@ static inline int fls (unsigned int x)
 	return 32 - __cntlz(x);
 }
 
+/**
+ * __fls - find last (most-significant) set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __fls(unsigned long word)
+{
+	return 31 - __cntlz(word);
+}
 #else
 
 /* Use the generic implementation if we don't have the nsa/nsau instructions. */
@@ -90,6 +100,7 @@ static inline int fls (unsigned int x)
 # include <asm-generic/bitops/__ffs.h>
 # include <asm-generic/bitops/ffz.h>
 # include <asm-generic/bitops/fls.h>
+# include <asm-generic/bitops/__fls.h>
 
 #endif
 

commit 5c134dad43443aa9c9606eaf47c378a6b9c5c597
Author: Rusty Russell <rusty@...tcorp.com.au>
Date:   Sat Jan 3 16:19:03 2009 +1030

    mn10300: define __fls
    
    Like fls, but can't be handed 0 and returns the bit number.
    
    Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>

diff --git a/include/asm-mn10300/bitops.h b/include/asm-mn10300/bitops.h
index cc6d40c..0b610f4 100644
--- a/include/asm-mn10300/bitops.h
+++ b/include/asm-mn10300/bitops.h
@@ -196,6 +196,17 @@ int fls(int x)
 }
 
 /**
+ * __fls - find last (most-significant) set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __fls(unsigned long word)
+{
+	return __ilog2_u32(word);
+}
+
+/**
  * ffs - find first bit set
  * @x: the word to search
  *

commit 16a206260ee70f181de6a3672678545859589ef2
Author: Rusty Russell <rusty@...tcorp.com.au>
Date:   Sat Jan 3 16:16:54 2009 +1030

    m32r: define __fls
    
    Like fls, but can't be handed 0 and returns the bit number.
    
    Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>

diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index 6dc9b81..aaddf0d 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -251,6 +251,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 #include <asm-generic/bitops/ffz.h>
 #include <asm-generic/bitops/__ffs.h>
 #include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls64.h>
 
 #ifdef __KERNEL__

commit 9ddabc2a29163e4b243d10c5e06fc5584073d7ad
Author: Rusty Russell <rusty@...tcorp.com.au>
Date:   Sat Jan 3 16:16:04 2009 +1030

    h8300: define __fls
    
    Like fls, but can't be handed 0 and returns the bit number.
    
    Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>

diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h
index cb18e3b..cb9ddf5 100644
--- a/arch/h8300/include/asm/bitops.h
+++ b/arch/h8300/include/asm/bitops.h
@@ -207,6 +207,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
 #endif /* __KERNEL__ */
 
 #include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls64.h>
 
 #endif /* _H8300_BITOPS_H */

commit ee38e5140bafbf40e1bd25ab917ac8db54a27799
Author: Rusty Russell <rusty@...tcorp.com.au>
Date:   Sat Jan 3 16:14:05 2009 +1030

    frv: define __fls
    
    Like fls, but can't be handed 0 and returns the bit number.
    
    Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>

diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index 39456ba..287f6f6 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -339,6 +339,19 @@ int __ffs(unsigned long x)
 	return 31 - bit;
 }
 
+/**
+ * __fls - find last (most-significant) set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+static inline unsigned long __fls(unsigned long word)
+{
+	unsigned long bit;
+	asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word));
+	return bit;
+}
+
 /*
  * special slimline version of fls() for calculating ilog2_u32()
  * - note: no protection against n == 0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ