2 * linux/arch/arm/lib/memset.S
4 * Copyright (C) 1995-2000 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * ASM optimised string functions
12 #include <linux/linkage.h>
13 #include <asm/assembler.h>
19 1: subs r2, r2, #4 @ 1 do we have enough
20 blt 5f @ 1 bytes to align with?
22 strltb r1, [r0], #1 @ 1
23 strleb r1, [r0], #1 @ 1
25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
27 * The pointer is now aligned and the length is adjusted. Try doing the
32 ands r3, r0, #3 @ 1 unaligned?
35 * we know that the pointer in r0 is aligned to a word boundary.
37 orr r1, r1, r1, lsl #8
38 orr r1, r1, r1, lsl #16
43 * We need an extra register for this loop - save the return address and
51 stmgeia r0!, {r1, r3, ip, lr} @ 64 bytes at a time.
52 stmgeia r0!, {r1, r3, ip, lr}
53 stmgeia r0!, {r1, r3, ip, lr}
54 stmgeia r0!, {r1, r3, ip, lr}
56 ldmeqfd sp!, {pc} @ Now <64 bytes to go.
58 * No need to correct the count; we're only testing bits from now on
61 stmneia r0!, {r1, r3, ip, lr}
62 stmneia r0!, {r1, r3, ip, lr}
64 stmneia r0!, {r1, r3, ip, lr}
72 * When we get here, we've got less than 4 bytes to zero. We
73 * may have an unaligned pointer as well.