1 .text
2
3 .global reverse_bytes_order2
4
5
6
7 reverse_bytes_order2:
8 STMFD SP!, {R4-R12,LR}
9 ldr r12, =0xFF00FF
10 loop:
11 ldmia r0!, {r4-r11}
12
13
14
15 #ifdef THUMB_FW
16 rev16 r4,r4
17 rev16 r5,r5
18 rev16 r6,r6
19 rev16 r7,r7
20 rev16 r8,r8
21 rev16 r9,r9
22 rev16 r10,r10
23 rev16 r11,r11
24 #else
25
26 and r3, r12, r4, lsr #8
27 and r4, r4, r12
28 orr r4, r3, r4, asl #8
29
30 and r3, r12, r5, lsr #8
31 and r5, r5, r12
32 orr r5, r3, r5, asl #8
33
34 and r3, r12, r6, lsr #8
35 and r6, r6, r12
36 orr r6, r3, r6, asl #8
37
38 and r3, r12, r7, lsr #8
39 and r7, r7, r12
40 orr r7, r3, r7, asl #8
41
42 and r3, r12, r8, lsr #8
43 and r8, r8, r12
44 orr r8, r3, r8, asl #8
45
46 and r3, r12, r9, lsr #8
47 and r9, r9, r12
48 orr r9, r3, r9, asl #8
49
50 and r3, r12, r10, lsr #8
51 and r10, r10, r12
52 orr r10, r3, r10, asl #8
53
54 and r3, r12, r11, lsr #8
55 and r11, r11, r12
56 orr r11, r3, r11, asl #8
57 #endif
58 stmia r1!, {r4-r11}
59
60 subs r2, r2, #32
61 bgt loop
62 LDMFD SP!, {R4-R12,LR}
63 bx lr