xref: /openbmc/linux/arch/arm/lib/io-writesl.S (revision f3a8b664)
1/*
2 *  linux/arch/arm/lib/io-writesl.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
14ENTRY(__raw_writesl)
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}
231:		ldmia	r1!, {r3, r4, ip, lr}
24		subs	r2, r2, #4
25		str	r3, [r0, #0]
26		str	r4, [r0, #0]
27		str	ip, [r0, #0]
28		str	lr, [r0, #0]
29		bpl	1b
30		ldmfd	sp!, {r4, lr}
312:		movs	r2, r2, lsl #31
32		ldmcsia	r1!, {r3, ip}
33		strcs	r3, [r0, #0]
34		ldrne	r3, [r1, #0]
35		strcs	ip, [r0, #0]
36		strne	r3, [r0, #0]
37		ret	lr
38
393:		bic	r1, r1, #3
40		ldr	r3, [r1], #4
41		cmp	ip, #2
42		blt	5f
43		bgt	6f
44
454:		mov	ip, r3, lspull #16
46		ldr	r3, [r1], #4
47		subs	r2, r2, #1
48		orr	ip, ip, r3, lspush #16
49		str	ip, [r0]
50		bne	4b
51		ret	lr
52
535:		mov	ip, r3, lspull #8
54		ldr	r3, [r1], #4
55		subs	r2, r2, #1
56		orr	ip, ip, r3, lspush #24
57		str	ip, [r0]
58		bne	5b
59		ret	lr
60
616:		mov	ip, r3, lspull #24
62		ldr	r3, [r1], #4
63		subs	r2, r2, #1
64		orr	ip, ip, r3, lspush #8
65		str	ip, [r0]
66		bne	6b
67		ret	lr
68ENDPROC(__raw_writesl)
69EXPORT_SYMBOL(__raw_writesl)
70