Linux 2.6.25-rc4
[linux-2.6/next.git] / arch / arm / lib / io-writesw-armv4.S
blobc8e85bd653b7aaa7b7cb8c30b0a90615390fd1ea
1 /*
2  *  linux/arch/arm/lib/io-writesw-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>
13                 .macro  outword, rd
14 #ifndef __ARMEB__
15                 strh    \rd, [r0]
16                 mov     \rd, \rd, lsr #16
17                 strh    \rd, [r0]
18 #else
19                 mov     lr, \rd, lsr #16
20                 strh    lr, [r0]
21                 strh    \rd, [r0]
22 #endif
23                 .endm
25 .Loutsw_align:  movs    ip, r1, lsl #31
26                 bne     .Loutsw_noalign
28                 ldrh    r3, [r1], #2
29                 sub     r2, r2, #1
30                 strh    r3, [r0]
32 ENTRY(__raw_writesw)
33                 teq     r2, #0
34                 moveq   pc, lr
35                 ands    r3, r1, #3
36                 bne     .Loutsw_align
38                 stmfd   sp!, {r4, r5, lr}
40                 subs    r2, r2, #8
41                 bmi     .Lno_outsw_8
43 .Loutsw_8_lp:   ldmia   r1!, {r3, r4, r5, ip}
44                 subs    r2, r2, #8
45                 outword r3
46                 outword r4
47                 outword r5
48                 outword ip
49                 bpl     .Loutsw_8_lp
51 .Lno_outsw_8:   tst     r2, #4
52                 beq     .Lno_outsw_4
54                 ldmia   r1!, {r3, ip}
55                 outword r3
56                 outword ip
58 .Lno_outsw_4:   movs    r2, r2, lsl #31
59                 bcc     .Lno_outsw_2
61                 ldr     r3, [r1], #4
62                 outword r3
64 .Lno_outsw_2:   ldrneh  r3, [r1]
65                 strneh  r3, [r0]
67                 ldmfd   sp!, {r4, r5, pc}
69 #ifdef __ARMEB__
70 #define pull_hbyte0     lsl #8
71 #define push_hbyte1     lsr #24
72 #else
73 #define pull_hbyte0     lsr #24
74 #define push_hbyte1     lsl #8
75 #endif
77 .Loutsw_noalign:
78                 ldr     r3, [r1, -r3]!
79                 subcs   r2, r2, #1
80                 bcs     2f
81                 subs    r2, r2, #2
82                 bmi     3f
84 1:              mov     ip, r3, lsr #8
85                 strh    ip, [r0]
86 2:              mov     ip, r3, pull_hbyte0
87                 ldr     r3, [r1, #4]!
88                 subs    r2, r2, #2
89                 orr     ip, ip, r3, push_hbyte1
90                 strh    ip, [r0]
91                 bpl     1b
93                 tst     r2, #1
94 3:              movne   ip, r3, lsr #8
95                 strneh  ip, [r0]
96                 mov     pc, lr