---- linux-2.6.19.2.orig/arch/cris/arch-v10/lib/memset.c 2007-05-20 01:46:35.000000000 +0200
-+++ linux-2.6.19.2/arch/cris/arch-v10/lib/memset.c 2007-05-20 01:51:47.000000000 +0200
-@@ -29,224 +29,21 @@
-
- #include <linux/types.h>
-
--/* No, there's no macro saying 12*4, since it is "hard" to get it into
-- the asm in a good way. Thus better to expose the problem everywhere.
-- */
-
--/* Assuming 1 cycle per dword written or read (ok, not really true), and
-- one per instruction, then 43+3*(n/48-1) <= 24+24*(n/48-1)
-- so n >= 45.7; n >= 0.9; we win on the first full 48-byte block to set. */
--
--#define ZERO_BLOCK_SIZE (1*12*4)
--
--void *memset(void *pdst,
-- int c,
-- size_t plen)
-+/**
-+ * memset - Fill a region of memory with the given value
-+ * @s: Pointer to the start of the area.
-+ * @c: The byte to fill the area with
-+ * @count: The size of the area.
-+ *
-+ * Do not use memset() to access IO space, use memset_io() instead.
-+ */
-+void *memset(void *s, int c, size_t count)
- {
-- /* Ok. Now we want the parameters put in special registers.
-- Make sure the compiler is able to make something useful of this. */
--
-- register char *return_dst __asm__ ("r10") = pdst;
-- register int n __asm__ ("r12") = plen;
-- register int lc __asm__ ("r11") = c;
--
-- /* Most apps use memset sanely. Only those memsetting about 3..4
-- bytes or less get penalized compared to the generic implementation
-- - and that's not really sane use. */
--
-- /* Ugh. This is fragile at best. Check with newer GCC releases, if
-- they compile cascaded "x |= x << 8" sanely! */
-- __asm__("movu.b %0,$r13\n\t"
-- "lslq 8,$r13\n\t"
-- "move.b %0,$r13\n\t"
-- "move.d $r13,%0\n\t"
-- "lslq 16,$r13\n\t"
-- "or.d $r13,%0"
-- : "=r" (lc) : "0" (lc) : "r13");
--
-- {
-- register char *dst __asm__ ("r13") = pdst;
--
-- /* This is NONPORTABLE, but since this whole routine is */
-- /* grossly nonportable that doesn't matter. */
--
-- if (((unsigned long) pdst & 3) != 0
-- /* Oops! n=0 must be a legal call, regardless of alignment. */
-- && n >= 3)
-- {
-- if ((unsigned long)dst & 1)
-- {
-- *dst = (char) lc;
-- n--;
-- dst++;
-- }
--
-- if ((unsigned long)dst & 2)
-- {
-- *(short *)dst = lc;
-- n -= 2;
-- dst += 2;
-- }
-- }
--
-- /* Now the fun part. For the threshold value of this, check the equation
-- above. */
-- /* Decide which copying method to use. */
-- if (n >= ZERO_BLOCK_SIZE)
-- {
-- /* For large copies we use 'movem' */
--
-- /* It is not optimal to tell the compiler about clobbering any
-- registers; that will move the saving/restoring of those registers
-- to the function prologue/epilogue, and make non-movem sizes
-- suboptimal.
--
-- This method is not foolproof; it assumes that the "asm reg"
-- declarations at the beginning of the function really are used
-- here (beware: they may be moved to temporary registers).
-- This way, we do not have to save/move the registers around into
-- temporaries; we can safely use them straight away.
--
-- If you want to check that the allocation was right; then
-- check the equalities in the first comment. It should say
-- "r13=r13, r12=r12, r11=r11" */