Linux 2.6.25-rc4
[linux-2.6/next.git] / arch / arm / lib / io-readsw-armv3.S
blob4ef9041851423fb7006cd6d8210a5bcec395ee72
1 /*
2  *  linux/arch/arm/lib/io-readsw-armv3.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>
14 .Linsw_bad_alignment:
15                 adr     r0, .Linsw_bad_align_msg
16                 mov     r2, lr
17                 b       panic
18 .Linsw_bad_align_msg:
19                 .asciz  "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
20                 .align
22 .Linsw_align:   tst     r1, #1
23                 bne     .Linsw_bad_alignment
25                 ldr     r3, [r0]
26                 strb    r3, [r1], #1
27                 mov     r3, r3, lsr #8
28                 strb    r3, [r1], #1
30                 subs    r2, r2, #1
31                 moveq   pc, lr
33 ENTRY(__raw_readsw)
34                 teq     r2, #0          @ do we have to check for the zero len?
35                 moveq   pc, lr
36                 tst     r1, #3
37                 bne     .Linsw_align
39 .Linsw_aligned: mov     ip, #0xff
40                 orr     ip, ip, ip, lsl #8
41                 stmfd   sp!, {r4, r5, r6, lr}
43                 subs    r2, r2, #8
44                 bmi     .Lno_insw_8
46 .Linsw_8_lp:    ldr     r3, [r0]
47                 and     r3, r3, ip
48                 ldr     r4, [r0]
49                 orr     r3, r3, r4, lsl #16
51                 ldr     r4, [r0]
52                 and     r4, r4, ip
53                 ldr     r5, [r0]
54                 orr     r4, r4, r5, lsl #16
56                 ldr     r5, [r0]
57                 and     r5, r5, ip
58                 ldr     r6, [r0]
59                 orr     r5, r5, r6, lsl #16
61                 ldr     r6, [r0]
62                 and     r6, r6, ip
63                 ldr     lr, [r0]
64                 orr     r6, r6, lr, lsl #16
66                 stmia   r1!, {r3 - r6}
68                 subs    r2, r2, #8
69                 bpl     .Linsw_8_lp
71                 tst     r2, #7
72                 ldmeqfd sp!, {r4, r5, r6, pc}
74 .Lno_insw_8:    tst     r2, #4
75                 beq     .Lno_insw_4
77                 ldr     r3, [r0]
78                 and     r3, r3, ip
79                 ldr     r4, [r0]
80                 orr     r3, r3, r4, lsl #16
82                 ldr     r4, [r0]
83                 and     r4, r4, ip
84                 ldr     r5, [r0]
85                 orr     r4, r4, r5, lsl #16
87                 stmia   r1!, {r3, r4}
89 .Lno_insw_4:    tst     r2, #2
90                 beq     .Lno_insw_2
92                 ldr     r3, [r0]
93                 and     r3, r3, ip
94                 ldr     r4, [r0]
95                 orr     r3, r3, r4, lsl #16
97                 str     r3, [r1], #4
99 .Lno_insw_2:    tst     r2, #1
100                 ldrne   r3, [r0]
101                 strneb  r3, [r1], #1
102                 movne   r3, r3, lsr #8
103                 strneb  r3, [r1]
105                 ldmfd   sp!, {r4, r5, r6, pc}