1/*
2 *  linux/arch/arm26/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/hardware.h>
13
14/*
15 * Note that some reads can be aligned on half-word boundaries.
16 */
17ENTRY(__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
231:		ldr	r3, [r0]
24		str	r3, [r1], #4
25		subs	r2, r2, #1
26		bne	1b
27		mov	pc, lr
28
292:		cmp	ip, #2
30		ldr	ip, [r0]
31		blt	4f
32		bgt	6f
33
34		strb	ip, [r1], #1
35		mov	ip, ip, lsr #8
36		strb	ip, [r1], #1
37		mov	ip, ip, lsr #8
383:		subs	r2, r2, #1
39		ldrne	r3, [r0]
40		orrne	ip, ip, r3, lsl #16
41		strne	ip, [r1], #4
42		movne	ip, r3, lsr #16
43		bne	3b
44		strb	ip, [r1], #1
45		mov	ip, ip, lsr #8
46		strb	ip, [r1], #1
47		mov	pc, lr
48
494:		strb	ip, [r1], #1
50		mov	ip, ip, lsr #8
51		strb	ip, [r1], #1
52		mov	ip, ip, lsr #8
53		strb	ip, [r1], #1
54		mov	ip, ip, lsr #8
555:		subs	r2, r2, #1
56		ldrne	r3, [r0]
57		orrne	ip, ip, r3, lsl #8
58		strne	ip, [r1], #4
59		movne	ip, r3, lsr #24
60		bne	5b
61		strb	ip, [r1], #1
62		mov	pc, lr
63
646:		strb	ip, [r1], #1
65		mov	ip, ip, lsr #8
667:		subs	r2, r2, #1
67		ldrne	r3, [r0]
68		orrne	ip, ip, r3, lsl #24
69		strne	ip, [r1], #4
70		movne	ip, r3, lsr #8
71		bne	7b
72		strb	ip, [r1], #1
73		mov	ip, ip, lsr #8
74		strb	ip, [r1], #1
75		mov	ip, ip, lsr #8
76		strb	ip, [r1], #1
77		mov	pc, lr
78