xref: /linux/arch/arm/lib/io-readsl.S (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*d2912cb1SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */
21da177e4SLinus Torvalds/*
31da177e4SLinus Torvalds *  linux/arch/arm/lib/io-readsl.S
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds *  Copyright (C) 1995-2000 Russell King
61da177e4SLinus Torvalds */
71da177e4SLinus Torvalds#include <linux/linkage.h>
81da177e4SLinus Torvalds#include <asm/assembler.h>
91da177e4SLinus Torvalds
101da177e4SLinus TorvaldsENTRY(__raw_readsl)
111da177e4SLinus Torvalds		teq	r2, #0		@ do we have to check for the zero len?
126ebbf2ceSRussell King		reteq	lr
131da177e4SLinus Torvalds		ands	ip, r1, #3
141da177e4SLinus Torvalds		bne	3f
151da177e4SLinus Torvalds
161da177e4SLinus Torvalds		subs	r2, r2, #4
171da177e4SLinus Torvalds		bmi	2f
181da177e4SLinus Torvalds		stmfd	sp!, {r4, lr}
191da177e4SLinus Torvalds1:		ldr	r3, [r0, #0]
201da177e4SLinus Torvalds		ldr	r4, [r0, #0]
211da177e4SLinus Torvalds		ldr	ip, [r0, #0]
221da177e4SLinus Torvalds		ldr	lr, [r0, #0]
231da177e4SLinus Torvalds		subs	r2, r2, #4
241da177e4SLinus Torvalds		stmia	r1!, {r3, r4, ip, lr}
251da177e4SLinus Torvalds		bpl	1b
261da177e4SLinus Torvalds		ldmfd	sp!, {r4, lr}
271da177e4SLinus Torvalds2:		movs	r2, r2, lsl #31
281da177e4SLinus Torvalds		ldrcs	r3, [r0, #0]
291da177e4SLinus Torvalds		ldrcs	ip, [r0, #0]
30e44fc388SStefan Agner		stmiacs	r1!, {r3, ip}
311da177e4SLinus Torvalds		ldrne	r3, [r0, #0]
321da177e4SLinus Torvalds		strne	r3, [r1, #0]
336ebbf2ceSRussell King		ret	lr
341da177e4SLinus Torvalds
351da177e4SLinus Torvalds3:		ldr	r3, [r0]
361da177e4SLinus Torvalds		cmp	ip, #2
371da177e4SLinus Torvalds		mov	ip, r3, get_byte_0
381da177e4SLinus Torvalds		strb	ip, [r1], #1
391da177e4SLinus Torvalds		bgt	6f
401da177e4SLinus Torvalds		mov	ip, r3, get_byte_1
411da177e4SLinus Torvalds		strb	ip, [r1], #1
421da177e4SLinus Torvalds		beq	5f
431da177e4SLinus Torvalds		mov	ip, r3, get_byte_2
441da177e4SLinus Torvalds		strb	ip, [r1], #1
451da177e4SLinus Torvalds
461da177e4SLinus Torvalds4:		subs	r2, r2, #1
47d98b90eaSVictor Kamensky		mov	ip, r3, lspull #24
481da177e4SLinus Torvalds		ldrne	r3, [r0]
49d98b90eaSVictor Kamensky		orrne	ip, ip, r3, lspush #8
501da177e4SLinus Torvalds		strne	ip, [r1], #4
511da177e4SLinus Torvalds		bne	4b
521da177e4SLinus Torvalds		b	8f
531da177e4SLinus Torvalds
541da177e4SLinus Torvalds5:		subs	r2, r2, #1
55d98b90eaSVictor Kamensky		mov	ip, r3, lspull #16
561da177e4SLinus Torvalds		ldrne	r3, [r0]
57d98b90eaSVictor Kamensky		orrne	ip, ip, r3, lspush #16
581da177e4SLinus Torvalds		strne	ip, [r1], #4
591da177e4SLinus Torvalds		bne	5b
601da177e4SLinus Torvalds		b	7f
611da177e4SLinus Torvalds
621da177e4SLinus Torvalds6:		subs	r2, r2, #1
63d98b90eaSVictor Kamensky		mov	ip, r3, lspull #8
641da177e4SLinus Torvalds		ldrne	r3, [r0]
65d98b90eaSVictor Kamensky		orrne	ip, ip, r3, lspush #24
661da177e4SLinus Torvalds		strne	ip, [r1], #4
671da177e4SLinus Torvalds		bne	6b
681da177e4SLinus Torvalds
691da177e4SLinus Torvalds		mov	r3, ip, get_byte_2
701da177e4SLinus Torvalds		strb	r3, [r1, #2]
711da177e4SLinus Torvalds7:		mov	r3, ip, get_byte_1
721da177e4SLinus Torvalds		strb	r3, [r1, #1]
731da177e4SLinus Torvalds8:		mov	r3, ip, get_byte_0
741da177e4SLinus Torvalds		strb	r3, [r1, #0]
756ebbf2ceSRussell King		ret	lr
7693ed3970SCatalin MarinasENDPROC(__raw_readsl)
77