summaryrefslogtreecommitdiff
path: root/firmware/target/arm/memswap128-arm.S
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/memswap128-arm.S')
-rw-r--r--firmware/target/arm/memswap128-arm.S88
1 files changed, 44 insertions, 44 deletions
diff --git a/firmware/target/arm/memswap128-arm.S b/firmware/target/arm/memswap128-arm.S
index f5276ef353..f672def1ec 100644
--- a/firmware/target/arm/memswap128-arm.S
+++ b/firmware/target/arm/memswap128-arm.S
@@ -1,44 +1,44 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2007 by Michael Sevakis 10 * Copyright (C) 2007 by Michael Sevakis
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
14 * 14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20/**************************************************************************** 20/****************************************************************************
21 * void memswap128(void *buf1, void *buf2, size_t len) 21 * void memswap128(void *buf1, void *buf2, size_t len)
22 */ 22 */
23 .section .icode, "ax", %progbits 23 .section .icode, "ax", %progbits
24 .align 2 24 .align 2
25 .global memswap128 25 .global memswap128
26 .type memswap128, %function 26 .type memswap128, %function
27memswap128: 27memswap128:
28 @ r0 = buf1 28 @ r0 = buf1
29 @ r1 = buf2 29 @ r1 = buf2
30 @ r2 = len 30 @ r2 = len
31 movs r2, r2, lsr #4 @ bytes => lines, len == 0? 31 movs r2, r2, lsr #4 @ bytes => lines, len == 0?
32 moveq pc, lr @ not at least a line? leave 32 moveq pc, lr @ not at least a line? leave
33 stmdb sp!, { r4-r10, lr } @ save registers and return address 33 stmdb sp!, { r4-r10, lr } @ save registers and return address
34.loop: @ 34.loop: @
35 ldmia r0, { r3-r6 } @ read four longwords from buf1 35 ldmia r0, { r3-r6 } @ read four longwords from buf1
36 ldmia r1, { r7-r10 } @ read four longwords from buf2 36 ldmia r1, { r7-r10 } @ read four longwords from buf2
37 stmia r0!, { r7-r10 } @ write buf2 data to buf1, buf1 += 16 37 stmia r0!, { r7-r10 } @ write buf2 data to buf1, buf1 += 16
38 stmia r1!, { r3-r6 } @ write buf1 data to buf2, buf2 += 16 38 stmia r1!, { r3-r6 } @ write buf1 data to buf2, buf2 += 16
39 subs r2, r2, #1 @ len -= 1, len > 0 ? 39 subs r2, r2, #1 @ len -= 1, len > 0 ?
40 bhi .loop @ yes? keep exchanging 40 bhi .loop @ yes? keep exchanging
41 ldmia sp!, { r4-r10, pc } @ restore registers and return 41 ldmia sp!, { r4-r10, pc } @ restore registers and return
42.end: 42.end:
43 .size memswap128, .end-memswap128 43 .size memswap128, .end-memswap128
44 44