History log of /arch/sparc/lib/memset.S
Revision Date Author Comments
4d14a459857bd151ecbd14bcd37b4628da00792b 11-Dec-2009 David S. Miller <davem@davemloft.net> sparc: Stop trying to be so fancy and use __builtin_{memcpy,memset}()

This mirrors commit ff60fab71bb3b4fdbf8caf57ff3739ffd0887396
(x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy)

Signed-off-by: David S. Miller <davem@davemloft.net>
f61698e6489f229f9fcfe29e68f228389a772993 24-Jul-2007 Alexander Shmelev <ashmelev@task.sun.mcst.ru> [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>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!