import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / lib / io-readsl-armv4.S
1 /*
2  *  linux/arch/arm/lib/io-readsl-armv4.S
3  *
4  *  Copyright (C) 1995-2000 Russell King
5  *
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.
9  */
10 #include <linux/linkage.h>
11 #include <asm/assembler.h>
12 #include <asm/hardware.h>
13
14 /*
15  * Note that some reads can be aligned on half-word boundaries.
16  */
17 ENTRY(__raw_readsl)
18                 teq     r2, #0          @ do we have to check for the zero len?
19                 moveq   pc, lr
20                 ands    ip, r1, #3
21                 bne     2f
22
23 1:              ldr     r3, [r0]
24                 str     r3, [r1], #4
25                 subs    r2, r2, #1
26                 bne     1b
27                 mov     pc, lr
28
29 2:              cmp     ip, #2
30                 ldr     ip, [r0]
31                 blt     4f
32                 bgt     6f
33
34                 strh    ip, [r1], #2
35                 mov     ip, ip, lsr #16
36 3:              subs    r2, r2, #1
37                 ldrne   r3, [r0]
38                 orrne   ip, ip, r3, lsl #16
39                 strne   ip, [r1], #4
40                 movne   ip, r3, lsr #16
41                 bne     3b
42                 strh    ip, [r1], #2
43                 mov     pc, lr
44
45 4:              strb    ip, [r1], #1
46                 mov     ip, ip, lsr #8
47                 strh    ip, [r1], #2
48                 mov     ip, ip, lsr #16
49 5:              subs    r2, r2, #1
50                 ldrne   r3, [r0]
51                 orrne   ip, ip, r3, lsl #8
52                 strne   ip, [r1], #4
53                 movne   ip, r3, lsr #24
54                 bne     5b
55                 strb    ip, [r1], #1
56                 mov     pc, lr
57
58 6:              strb    ip, [r1], #1
59                 mov     ip, ip, lsr #8
60 7:              subs    r2, r2, #1
61                 ldrne   r3, [r0]
62                 orrne   ip, ip, r3, lsl #24
63                 strne   ip, [r1], #4
64                 movne   ip, r3, lsr #8
65                 bne     7b
66                 strh    ip, [r1], #2
67                 mov     ip, ip, lsr #16
68                 strb    ip, [r1]
69                 mov     pc, lr
70