OpenCloudOS-Kernel/arch/sparc/lib
Alexander Shmelev f61698e648 [SPARC32]: Fix bug in sparc optimized memset.
Sparc optimized memset (arch/sparc/lib/memset.S) does not fill last
byte of the memory area, if area size is less than 8 bytes and start
address is not word (4-bytes) aligned.

Here is code chunk where bug located:
/* %o0 - memory address, %o1 - size, %g3 - value */
8:
     add    %o0, 1, %o0
    subcc    %o1, 1, %o1
    bne,a    8b
     stb %g3, [%o0 - 1]

This code should write byte every loop iteration, but last time delay
instruction stb is not executed because branch instruction sets
"annul" bit.

Patch replaces bne,a by bne instruction.

Error can be reproduced by simple kernel module:

--------------------
#include <linux/module.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <string.h>

static void do_memset(void **p, int size)
{
        memset(p, 0x00, size);
}

static int __init memset_test_init(void)
{
    char fooc[8];
    int *fooi;
    memset(fooc, 0xba, sizeof(fooc));

    do_memset((void**)(fooc + 3), 1);

    fooi = (int*) fooc;
    printk("%08X %08X\n", fooi[0], fooi[1]);

    return -1;
}

static void __exit memset_test_cleanup(void)
{
    return;
}

module_init(memset_test_init);
module_exit(memset_test_cleanup);

MODULE_LICENSE("GPL");
EXPORT_NO_SYMBOLS;
--------------------

Signed-off-by: Alexander Shmelev <ashmelev@task.sun.mcst.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-07-24 13:41:44 -07:00
..
COPYING.LIB Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile [SPARC]: Make bitops use same spinlocks as atomics. 2006-12-17 16:18:47 -08:00
ashldi3.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ashrdi3.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
atomic.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
atomic32.c [SPARC32]: Build fix. 2007-05-31 01:52:51 -07:00
bitext.c header cleaning: don't include smp_lock.h when not used 2007-05-08 11:15:07 -07:00
blockops.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
checksum.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
copy_user.S [SPARC]: Don't zero out tail during copy_from_user_inatomic(). 2006-09-29 16:12:41 -07:00
divdi3.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iomap.c [SPARC]: Add iomap interfaces. 2006-06-25 23:24:24 -07:00
locks.S [PATCH] sparc32 rwlock fix 2006-10-08 12:32:35 -07:00
lshrdi3.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
memcmp.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
memcpy.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
memscan.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
memset.S [SPARC32]: Fix bug in sparc optimized memset. 2007-07-24 13:41:44 -07:00
mul.S [SPARC]: Fix dot-symbol exporting for good. 2005-09-11 20:14:07 -07:00
muldi3.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rem.S [SPARC]: Fix dot-symbol exporting for good. 2005-09-11 20:14:07 -07:00
rwsem.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sdiv.S [SPARC]: Fix dot-symbol exporting for good. 2005-09-11 20:14:07 -07:00
strlen.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
strlen_user.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
strncmp.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
strncpy_from_user.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
udiv.S [SPARC]: Fix dot-symbol exporting for good. 2005-09-11 20:14:07 -07:00
udivdi3.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
umul.S [SPARC]: Fix dot-symbol exporting for good. 2005-09-11 20:14:07 -07:00
urem.S [SPARC]: Fix dot-symbol exporting for good. 2005-09-11 20:14:07 -07:00