3 * - By John Hodge (thePowersGang)
6 * - Assembly editions of library functions
8 #include "include/assembly.h"
13 tst r2, r2 @ Check counter
14 moveq pc, lr @ Return if zero
15 ldrb r3, [r1],#1 @ Read
16 strb r3, [r0],#1 @ Write
21 @ Pre-aligned memcpy (32-bit blocks)
23 .globl __memcpy_align4
26 mvn r3, #3 @ Mask for checking length
35 @ single byte copies to finish off
52 mov r4, #0 @ Return value
53 mov r3, #1 @ add value
55 @ Scan up for first larger multiple of 2
58 lsl r1, r1, #1 @ D <<= 1
59 lsls r3, r3, #1 @ add <<= 1
60 beq .err @ result is zero
64 2: lsrs r3, r3, #1 @ add >>= 1
65 beq 3f @ Done (value is zero)
66 lsr r1, r1, #1 @ D >>= 1
70 add r4, r3 @ ret += add
73 tst r2, r2 @ Remainder (if wanted)
75 mov r0, r4 @ Return value