Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[cascardo/linux.git] / arch / arm / lib / io-readsl.S
1 /*
2  *  linux/arch/arm/lib/io-readsl.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/export.h>
13
14 ENTRY(__raw_readsl)
15                 teq     r2, #0          @ do we have to check for the zero len?
16                 reteq   lr
17                 ands    ip, r1, #3
18                 bne     3f
19
20                 subs    r2, r2, #4
21                 bmi     2f
22                 stmfd   sp!, {r4, lr}
23 1:              ldr     r3, [r0, #0]
24                 ldr     r4, [r0, #0]
25                 ldr     ip, [r0, #0]
26                 ldr     lr, [r0, #0]
27                 subs    r2, r2, #4
28                 stmia   r1!, {r3, r4, ip, lr}
29                 bpl     1b
30                 ldmfd   sp!, {r4, lr}
31 2:              movs    r2, r2, lsl #31
32                 ldrcs   r3, [r0, #0]
33                 ldrcs   ip, [r0, #0]
34                 stmcsia r1!, {r3, ip}
35                 ldrne   r3, [r0, #0]
36                 strne   r3, [r1, #0]
37                 ret     lr
38
39 3:              ldr     r3, [r0]
40                 cmp     ip, #2
41                 mov     ip, r3, get_byte_0
42                 strb    ip, [r1], #1
43                 bgt     6f
44                 mov     ip, r3, get_byte_1
45                 strb    ip, [r1], #1
46                 beq     5f
47                 mov     ip, r3, get_byte_2
48                 strb    ip, [r1], #1
49
50 4:              subs    r2, r2, #1
51                 mov     ip, r3, lspull #24
52                 ldrne   r3, [r0]
53                 orrne   ip, ip, r3, lspush #8
54                 strne   ip, [r1], #4
55                 bne     4b
56                 b       8f
57
58 5:              subs    r2, r2, #1
59                 mov     ip, r3, lspull #16
60                 ldrne   r3, [r0]
61                 orrne   ip, ip, r3, lspush #16
62                 strne   ip, [r1], #4
63                 bne     5b
64                 b       7f
65
66 6:              subs    r2, r2, #1
67                 mov     ip, r3, lspull #8
68                 ldrne   r3, [r0]
69                 orrne   ip, ip, r3, lspush #24
70                 strne   ip, [r1], #4
71                 bne     6b
72
73                 mov     r3, ip, get_byte_2
74                 strb    r3, [r1, #2]
75 7:              mov     r3, ip, get_byte_1
76                 strb    r3, [r1, #1]
77 8:              mov     r3, ip, get_byte_0
78                 strb    r3, [r1, #0]
79                 ret     lr
80 ENDPROC(__raw_readsl)
81 EXPORT_SYMBOL(__raw_readsl)