linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/12] random pt4: Moving and sharing code
@ 2005-01-21 21:41 Matt Mackall
  2005-01-21 21:41 ` [PATCH 1/12] random pt4: Create new rol32/ror32 bitops Matt Mackall
  0 siblings, 1 reply; 30+ messages in thread
From: Matt Mackall @ 2005-01-21 21:41 UTC (permalink / raw)
  To: Andrew Morton, Theodore Ts'o; +Cc: linux-kernel

This series focuses on moving and sharing code in
/drivers/char/random.c. It applies on top of -mm2 which contains my
earlier patches.

New bitop:
1  Create new rol32/ror32 bitops
2  Use them throughout the tree

Share SHA code in lib:
3  Kill the SHA1 variants
4  Cleanup SHA1 interface
5  Move SHA1 code to lib/
6  Replace SHA1 with faster version
7  Update cryptolib to use SHA1 from lib

Share halfmd4 hash:
8  Move halfMD4 to lib
9  Kill duplicate halfMD4 in ext3 htree

Move network random bits:
10 Simplify and shrink syncookie code
11 Move syncookies to net/
12 Move other tcp/ip bits to net/

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [PATCH 1/12] random pt4: Create new rol32/ror32 bitops
@ 2005-01-23  2:10 Chuck Ebbert
  2005-01-23  2:45 ` Matt Mackall
  2005-01-23  3:19 ` Andi Kleen
  0 siblings, 2 replies; 30+ messages in thread
From: Chuck Ebbert @ 2005-01-23  2:10 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Theodore Ts'o, Andrew Morton, linux-kernel, Andi Kleen

On Fri, 21 Jan 2005 at 15:41:06 -0600 Matt Mackall wrote:

> Add rol32 and ror32 bitops to bitops.h

Can you test this patch on top of yours?  I did it on 2.6.10-ac10 but it
should apply OK.  Compile tested and booted, but only random.c is using it
in my kernel.

x86-64 could use this too...

Add i386 bitops for rol32/ror32:
Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

--- 2.6.10-ac10/include/linux/bitops.h~orig     2005-01-22 11:31:20.130239000 -0500
+++ 2.6.10-ac10/include/linux/bitops.h  2005-01-22 11:34:55.740239000 -0500
@@ -129,6 +129,7 @@
        return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
 }
 
+#ifndef __HAVE_ARCH_ROTATE_32
 /*
  * rol32 - rotate a 32-bit value left
  *
@@ -150,5 +151,6 @@
 {
        return (word >> shift) | (word << (32 - shift));
 }
+#endif /* ndef __HAVE_ARCH_ROTATE_32 */
 
 #endif
--- 2.6.10-ac10/include/asm-i386/bitops.h~orig  2004-08-24 05:08:39.000000000 -0400
+++ 2.6.10-ac10/include/asm-i386/bitops.h       2005-01-22 11:42:12.010239000 -0500
@@ -431,6 +431,41 @@
 #define hweight16(x) generic_hweight16(x)
 #define hweight8(x) generic_hweight8(x)
 
+#define __HAVE_ARCH_ROTATE_32
+/*
+ * rol32 - rotate a 32-bit value left
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 rol32(__u32 word, int shift)
+{
+       __u32 res;
+
+       asm("roll %%cl,%0"
+           : "=r" (res)
+           : "0" (word), "c" (shift)
+           : "cc");
+       return res;
+}
+
+/*
+ * ror32 - rotate a 32-bit value right
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 ror32(__u32 word, int shift)
+{
+       __u32 res;
+
+       asm("rorl %%cl,%0"
+           : "=r" (res)
+           : "0" (word), "c" (shift)
+           : "cc");
+       return res;
+}
+
 #endif /* __KERNEL__ */
 
 #ifdef __KERNEL__

Chuck

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [PATCH 1/12] random pt4: Create new rol32/ror32 bitops
@ 2005-01-23  7:44 Chuck Ebbert
  2005-01-24 22:16 ` H. Peter Anvin
  0 siblings, 1 reply; 30+ messages in thread
From: Chuck Ebbert @ 2005-01-23  7:44 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel, Andrew Morton, Theodore Ts'o

On Sat, 22 Jan 2005 at 20:13:24 -0800 Matt Mackall wrote:

> So I think tweaks for x86 at least are unnecessary. 

 So the compiler looks for that specific sequence of instructions:

        (a << b) | (a >> (sizeof(a) * 8 - b)

and recognizes that it means rotation?  Wow.


Chuck

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

end of thread, other threads:[~2005-01-27 19:28 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 21:41 [PATCH 0/12] random pt4: Moving and sharing code Matt Mackall
2005-01-21 21:41 ` [PATCH 1/12] random pt4: Create new rol32/ror32 bitops Matt Mackall
2005-01-21 21:41   ` [PATCH 2/12] random pt4: Use them throughout the tree Matt Mackall
2005-01-21 21:41     ` [PATCH 3/12] random pt4: Kill the SHA variants Matt Mackall
2005-01-21 21:41       ` [PATCH 4/12] random pt4: Cleanup SHA interface Matt Mackall
2005-01-21 21:41         ` [PATCH 5/12] random pt4: Move SHA code to lib/ Matt Mackall
2005-01-21 21:41           ` [PATCH 6/12] random pt4: Replace SHA with faster version Matt Mackall
2005-01-21 21:41             ` [PATCH 7/12] random pt4: Update cryptolib to use SHA fro lib Matt Mackall
2005-01-21 21:41               ` [PATCH 8/12] random pt4: Move halfmd4 to lib Matt Mackall
2005-01-21 21:41                 ` [PATCH 9/12] random pt4: Kill duplicate halfmd4 in ext3 htree Matt Mackall
2005-01-21 21:41                   ` [PATCH 10/12] random pt4: Simplify and shrink syncookie code Matt Mackall
2005-01-21 21:41                     ` [PATCH 11/12] random pt4: Move syncookies to net/ Matt Mackall
2005-01-21 21:41                       ` [PATCH 12/12] random pt4: Move other tcp/ip bits " Matt Mackall
2005-01-26  1:33               ` [PATCH 7/12] random pt4: Update cryptolib to use SHA fro lib Lee Revell
2005-01-26  1:42                 ` Matt Mackall
2005-01-25 21:07             ` [PATCH 6/12] random pt4: Replace SHA with faster version Denis Vlasenko
2005-01-25 21:14               ` Matt Mackall
2005-01-25 21:31                 ` Denis Vlasenko
2005-01-25 21:50                   ` [PATCH] SHA1 clarify kerneldoc Matt Mackall
2005-01-27 18:22                     ` Bill Davidsen
2005-01-27 19:28                       ` Matt Mackall
2005-01-25 20:49         ` [PATCH 4/12] random pt4: Cleanup SHA interface Denis Vlasenko
2005-01-25 21:01           ` Matt Mackall
2005-01-25 21:02   ` [PATCH 1/12] random pt4: Create new rol32/ror32 bitops Denis Vlasenko
2005-01-23  2:10 Chuck Ebbert
2005-01-23  2:45 ` Matt Mackall
2005-01-23  3:19 ` Andi Kleen
2005-01-23  4:13   ` Matt Mackall
2005-01-23  7:44 Chuck Ebbert
2005-01-24 22:16 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).