1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 by Thom Johansen
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 .section .icode,"ax",%progbits
27 /* The following code is based on code from the Linux kernel version 2.6.15.3,
28 * linux/arch/arm/lib/memset.S
30 * Copyright (C) 1995-2000 Russell King
34 .type memset16,%function
36 tst r0, #2 @ unaligned?
38 strneh r1, [r0], #2 @ store one halfword to align
42 * we know that the pointer in r0 is aligned to a word boundary.
44 orr r1, r1, r1, lsl #16
49 * We need an extra register for this loop - save the return address and
57 stmgeia r0!, {r1, r3, ip, lr} @ 64 bytes at a time.
58 stmgeia r0!, {r1, r3, ip, lr}
59 stmgeia r0!, {r1, r3, ip, lr}
60 stmgeia r0!, {r1, r3, ip, lr}
62 ldrpc cond=eq @ Now <64 bytes to go.
64 * No need to correct the count; we're only testing bits from now on
67 stmneia r0!, {r1, r3, ip, lr}
68 stmneia r0!, {r1, r3, ip, lr}
70 stmneia r0!, {r1, r3, ip, lr}
82 .size memset16,.end-memset16