--- /dev/null
+/* Copyright (C) 1998 Free Software Foundation, Inc.\r
+ This file is part of the GNU C Library.\r
+ Contributed by Philip Blundell <philb@gnu.org>\r
+\r
+ The GNU C Library is free software; you can redistribute it and/or\r
+ modify it under the terms of the GNU Lesser General Public\r
+ License as published by the Free Software Foundation; either\r
+ version 2.1 of the License, or (at your option) any later version.\r
+\r
+ The GNU C Library is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ Lesser General Public License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public\r
+ License along with the GNU C Library; if not, write to the Free\r
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\r
+ 02111-1307 USA. */\r
+\r
+@ #include <sys/syscall.h>\r
+\r
+ .text\r
+ .global memset\r
+ .type memset,%function\r
+ .align 4\r
+\r
+memset:\r
+ mov a4, a1\r
+ cmp a3, $8 @ at least 8 bytes to do?\r
+ blt 2f\r
+ orr a2, a2, a2, lsl $8\r
+ orr a2, a2, a2, lsl $16\r
+1:\r
+ tst a4, $3 @ aligned yet?\r
+ strneb a2, [a4], $1\r
+ subne a3, a3, $1\r
+ bne 1b\r
+ mov ip, a2\r
+1:\r
+ cmp a3, $8 @ 8 bytes still to do?\r
+ blt 2f\r
+ stmia a4!, {a2, ip}\r
+ sub a3, a3, $8\r
+ cmp a3, $8 @ 8 bytes still to do?\r
+ blt 2f\r
+ stmia a4!, {a2, ip}\r
+ sub a3, a3, $8\r
+ cmp a3, $8 @ 8 bytes still to do?\r
+ blt 2f\r
+ stmia a4!, {a2, ip}\r
+ sub a3, a3, $8\r
+ cmp a3, $8 @ 8 bytes still to do?\r
+ stmgeia a4!, {a2, ip}\r
+ subge a3, a3, $8\r
+ bge 1b\r
+2:\r
+ movs a3, a3 @ anything left?\r
+ moveq pc, lr @ nope\r
+ rsb a3, a3, $7\r
+ add pc, pc, a3, lsl $2\r
+ mov r0, r0\r
+ strb a2, [a4], $1\r
+ strb a2, [a4], $1\r
+ strb a2, [a4], $1\r
+ strb a2, [a4], $1\r
+ strb a2, [a4], $1\r
+ strb a2, [a4], $1\r
+ strb a2, [a4], $1\r
+ mov pc, lr\r
+\r
+.size memset,.-memset;\r
+\r