1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/arm/lib/io-readsw-armv4.S
5 * Copyright (C) 1995-2000 Russell King
7 #include <linux/linkage.h>
8 #include <asm/assembler.h>
10 .macro pack, rd, hw1, hw2
12 orr \rd, \hw1, \hw2, lsl #16
14 orr \rd, \hw2, \hw1, lsl #16
18 .Linsw_align: movs ip, r1, lsl #31
30 stmfd sp!, {r4, r5, lr}
35 .Linsw_8_lp: ldrh r3, [r0]
52 stmia r1!, {r3 - r5, ip}
55 .Lno_insw_8: tst r2, #4
68 .Lno_insw_4: movs r2, r2, lsl #31
76 .Lno_insw_2: ldrhne r3, [r0]
79 ldmfd sp!, {r4, r5, pc}
82 #define _BE_ONLY_(code...) code
83 #define _LE_ONLY_(code...)
84 #define push_hbyte0 lsr #8
85 #define pull_hbyte1 lsl #24
87 #define _BE_ONLY_(code...)
88 #define _LE_ONLY_(code...) code
89 #define push_hbyte0 lsl #24
90 #define pull_hbyte1 lsr #8
93 .Linsw_noalign: stmfd sp!, {r4, lr}
99 _BE_ONLY_( mov ip, ip, ror #8 )
101 _LE_ONLY_( mov ip, ip, lsr #8 )
102 _BE_ONLY_( mov ip, ip, lsr #24 )
106 _BE_ONLY_( mov ip, ip, lsl #24 )
111 orr ip, ip, r3, lsl #8
112 orr ip, ip, r4, push_hbyte0
114 mov ip, r4, pull_hbyte1
117 _BE_ONLY_( mov ip, ip, lsr #24 )
122 _BE_ONLY_( movne ip, ip, ror #8 )
124 _LE_ONLY_( movne ip, ip, lsr #8 )
125 _BE_ONLY_( movne ip, ip, lsr #24 )
128 ENDPROC(__raw_readsw)