[PATCH 06/10] ARM: update io-* from Linux

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Sep 25 09:04:57 PDT 2024


On 25.09.24 15:55, Sascha Hauer wrote:
> This updates io-readsb.S, io-readsl.S, io-readsw-armv4.S, io-writesb.S,
> io-writesl.S and io-writesw-armv4.S from Linux.

Likewise, please add version.

> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

> ---
>  arch/arm/lib32/io-readsb.S        | 28 +++++++++++++++-------------
>  arch/arm/lib32/io-readsl.S        | 16 +++++++++-------
>  arch/arm/lib32/io-readsw-armv4.S  | 22 ++++++++++++----------
>  arch/arm/lib32/io-writesb.S       | 30 ++++++++++++++++--------------
>  arch/arm/lib32/io-writesl.S       | 20 +++++++++++---------
>  arch/arm/lib32/io-writesw-armv4.S | 18 ++++++++++--------
>  6 files changed, 73 insertions(+), 61 deletions(-)
> 
> diff --git a/arch/arm/lib32/io-readsb.S b/arch/arm/lib32/io-readsb.S
> index 41f68092c5..2777a49b22 100644
> --- a/arch/arm/lib32/io-readsb.S
> +++ b/arch/arm/lib32/io-readsb.S
> @@ -1,12 +1,14 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
> -/* SPDX-FileCopyrightText: 1995-2000 Russell King */
> -
>  /*
>   *  linux/arch/arm/lib/io-readsb.S
> + *
> + *  Copyright (C) 1995-2000 Russell King
>   */
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>  
> +.syntax unified
> +
>  .section .text.__raw_readsb
>  
>  .Linsb_align:	rsb	ip, ip, #4
> @@ -15,16 +17,16 @@
>  		cmp	ip, #2
>  		ldrb	r3, [r0]
>  		strb	r3, [r1], #1
> -		ldrgeb	r3, [r0]
> -		strgeb	r3, [r1], #1
> -		ldrgtb	r3, [r0]
> -		strgtb	r3, [r1], #1
> +		ldrbge	r3, [r0]
> +		strbge	r3, [r1], #1
> +		ldrbgt	r3, [r0]
> +		strbgt	r3, [r1], #1
>  		subs	r2, r2, ip
>  		bne	.Linsb_aligned
>  
>  ENTRY(__raw_readsb)
>  		teq	r2, #0		@ do we have to check for the zero len?
> -		moveq	pc, lr
> +		reteq	lr
>  		ands	ip, r1, #3
>  		bne	.Linsb_align
>  
> @@ -71,7 +73,7 @@ ENTRY(__raw_readsb)
>  		bpl	.Linsb_16_lp
>  
>  		tst	r2, #15
> -		ldmeqfd	sp!, {r4 - r6, pc}
> +		ldmfdeq	sp!, {r4 - r6, pc}
>  
>  .Linsb_no_16:	tst	r2, #8
>  		beq	.Linsb_no_8
> @@ -108,15 +110,15 @@ ENTRY(__raw_readsb)
>  		str	r3, [r1], #4
>  
>  .Linsb_no_4:	ands	r2, r2, #3
> -		ldmeqfd	sp!, {r4 - r6, pc}
> +		ldmfdeq	sp!, {r4 - r6, pc}
>  
>  		cmp	r2, #2
>  		ldrb	r3, [r0]
>  		strb	r3, [r1], #1
> -		ldrgeb	r3, [r0]
> -		strgeb	r3, [r1], #1
> -		ldrgtb	r3, [r0]
> -		strgtb	r3, [r1]
> +		ldrbge	r3, [r0]
> +		strbge	r3, [r1], #1
> +		ldrbgt	r3, [r0]
> +		strbgt	r3, [r1]
>  
>  		ldmfd	sp!, {r4 - r6, pc}
>  ENDPROC(__raw_readsb)
> diff --git a/arch/arm/lib32/io-readsl.S b/arch/arm/lib32/io-readsl.S
> index 7bcd0d45bc..aecac1f9eb 100644
> --- a/arch/arm/lib32/io-readsl.S
> +++ b/arch/arm/lib32/io-readsl.S
> @@ -1,17 +1,19 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
> -/* SPDX-FileCopyrightText: 1995-2000 Russell King */
> -
>  /*
> - * linux/arch/arm/lib/io-readsl.S
> + *  linux/arch/arm/lib/io-readsl.S
> + *
> + *  Copyright (C) 1995-2000 Russell King
>   */
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>  
> +.syntax unified
> +
>  .section .text.__raw_readsl
>  
>  ENTRY(__raw_readsl)
>  		teq	r2, #0		@ do we have to check for the zero len?
> -		moveq	pc, lr
> +		reteq	lr
>  		ands	ip, r1, #3
>  		bne	3f
>  
> @@ -29,10 +31,10 @@ ENTRY(__raw_readsl)
>  2:		movs	r2, r2, lsl #31
>  		ldrcs	r3, [r0, #0]
>  		ldrcs	ip, [r0, #0]
> -		stmcsia	r1!, {r3, ip}
> +		stmiacs	r1!, {r3, ip}
>  		ldrne	r3, [r0, #0]
>  		strne	r3, [r1, #0]
> -		mov	pc, lr
> +		ret	lr
>  
>  3:		ldr	r3, [r0]
>  		cmp	ip, #2
> @@ -74,5 +76,5 @@ ENTRY(__raw_readsl)
>  		strb	r3, [r1, #1]
>  8:		mov	r3, ip, get_byte_0
>  		strb	r3, [r1, #0]
> -		mov	pc, lr
> +		ret	lr
>  ENDPROC(__raw_readsl)
> diff --git a/arch/arm/lib32/io-readsw-armv4.S b/arch/arm/lib32/io-readsw-armv4.S
> index 9fb7fd7576..f5c633027c 100644
> --- a/arch/arm/lib32/io-readsw-armv4.S
> +++ b/arch/arm/lib32/io-readsw-armv4.S
> @@ -1,12 +1,14 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
> -/* SPDX-FileCopyrightText: 1995-2000 Russell King */
> -
>  /*
> - * linux/arch/arm/lib/io-readsw-armv4.S
> + *  linux/arch/arm/lib/io-readsw-armv4.S
> + *
> + *  Copyright (C) 1995-2000 Russell King
>   */
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>  
> +.syntax unified
> +
>  		.macro	pack, rd, hw1, hw2
>  #ifndef __ARMEB__
>  		orr	\rd, \hw1, \hw2, lsl #16
> @@ -25,7 +27,7 @@
>  
>  ENTRY(__raw_readsw)
>  		teq	r2, #0
> -		moveq	pc, lr
> +		reteq	lr
>  		tst	r1, #3
>  		bne	.Linsw_align
>  
> @@ -75,8 +77,8 @@ ENTRY(__raw_readsw)
>  		pack	r3, r3, ip
>  		str	r3, [r1], #4
>  
> -.Lno_insw_2:	ldrneh	r3, [r0]
> -		strneh	r3, [r1]
> +.Lno_insw_2:	ldrhne	r3, [r0]
> +		strhne	r3, [r1]
>  
>  		ldmfd	sp!, {r4, r5, pc}
>  
> @@ -93,7 +95,7 @@ ENTRY(__raw_readsw)
>  #endif
>  
>  .Linsw_noalign:	stmfd	sp!, {r4, lr}
> -		ldrccb	ip, [r1, #-1]!
> +		ldrbcc	ip, [r1, #-1]!
>  		bcc	1f
>  
>  		ldrh	ip, [r0]
> @@ -120,11 +122,11 @@ ENTRY(__raw_readsw)
>  
>  3:		tst	r2, #1
>  		strb	ip, [r1], #1
> -		ldrneh	ip, [r0]
> +		ldrhne	ip, [r0]
>     _BE_ONLY_(	movne	ip, ip, ror #8		)
> -		strneb	ip, [r1], #1
> +		strbne	ip, [r1], #1
>     _LE_ONLY_(	movne	ip, ip, lsr #8		)
>     _BE_ONLY_(	movne	ip, ip, lsr #24		)
> -		strneb	ip, [r1]
> +		strbne	ip, [r1]
>  		ldmfd	sp!, {r4, pc}
>  ENDPROC(__raw_readsw)
> diff --git a/arch/arm/lib32/io-writesb.S b/arch/arm/lib32/io-writesb.S
> index b6ce85f0d4..0bfb1f914e 100644
> --- a/arch/arm/lib32/io-writesb.S
> +++ b/arch/arm/lib32/io-writesb.S
> @@ -1,12 +1,14 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
> -/* SPDX-FileCopyrightText: 1995-2000 Russell King */
> -
>  /*
> - * linux/arch/arm/lib/io-writesb.S
> + *  linux/arch/arm/lib/io-writesb.S
> + *
> + *  Copyright (C) 1995-2000 Russell King
>   */
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>  
> +.syntax unified
> +
>  		.macro	outword, rd
>  #ifndef __ARMEB__
>  		strb	\rd, [r0]
> @@ -35,16 +37,16 @@
>  		cmp	ip, #2
>  		ldrb	r3, [r1], #1
>  		strb	r3, [r0]
> -		ldrgeb	r3, [r1], #1
> -		strgeb	r3, [r0]
> -		ldrgtb	r3, [r1], #1
> -		strgtb	r3, [r0]
> +		ldrbge	r3, [r1], #1
> +		strbge	r3, [r0]
> +		ldrbgt	r3, [r1], #1
> +		strbgt	r3, [r0]
>  		subs	r2, r2, ip
>  		bne	.Loutsb_aligned
>  
>  ENTRY(__raw_writesb)
>  		teq	r2, #0		@ do we have to check for the zero len?
> -		moveq	pc, lr
> +		reteq	lr
>  		ands	ip, r1, #3
>  		bne	.Loutsb_align
>  
> @@ -63,7 +65,7 @@ ENTRY(__raw_writesb)
>  		bpl	.Loutsb_16_lp
>  
>  		tst	r2, #15
> -		ldmeqfd	sp!, {r4, r5, pc}
> +		ldmfdeq	sp!, {r4, r5, pc}
>  
>  .Loutsb_no_16:	tst	r2, #8
>  		beq	.Loutsb_no_8
> @@ -79,15 +81,15 @@ ENTRY(__raw_writesb)
>  		outword	r3
>  
>  .Loutsb_no_4:	ands	r2, r2, #3
> -		ldmeqfd	sp!, {r4, r5, pc}
> +		ldmfdeq	sp!, {r4, r5, pc}
>  
>  		cmp	r2, #2
>  		ldrb	r3, [r1], #1
>  		strb	r3, [r0]
> -		ldrgeb	r3, [r1], #1
> -		strgeb	r3, [r0]
> -		ldrgtb	r3, [r1]
> -		strgtb	r3, [r0]
> +		ldrbge	r3, [r1], #1
> +		strbge	r3, [r0]
> +		ldrbgt	r3, [r1]
> +		strbgt	r3, [r0]
>  
>  		ldmfd	sp!, {r4, r5, pc}
>  ENDPROC(__raw_writesb)
> diff --git a/arch/arm/lib32/io-writesl.S b/arch/arm/lib32/io-writesl.S
> index 61164234de..c300a62daf 100644
> --- a/arch/arm/lib32/io-writesl.S
> +++ b/arch/arm/lib32/io-writesl.S
> @@ -1,17 +1,19 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
> -/* SPDX-FileCopyrightText: 1995-2000 Russell King */
> -
>  /*
> - * linux/arch/arm/lib/io-writesl.S
> + *  linux/arch/arm/lib/io-writesl.S
> + *
> + *  Copyright (C) 1995-2000 Russell King
>   */
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>  
> +.syntax unified
> +
>  .section .text.__raw_writesl
>  
>  ENTRY(__raw_writesl)
>  		teq	r2, #0		@ do we have to check for the zero len?
> -		moveq	pc, lr
> +		reteq	lr
>  		ands	ip, r1, #3
>  		bne	3f
>  
> @@ -27,12 +29,12 @@ ENTRY(__raw_writesl)
>  		bpl	1b
>  		ldmfd	sp!, {r4, lr}
>  2:		movs	r2, r2, lsl #31
> -		ldmcsia	r1!, {r3, ip}
> +		ldmiacs	r1!, {r3, ip}
>  		strcs	r3, [r0, #0]
>  		ldrne	r3, [r1, #0]
>  		strcs	ip, [r0, #0]
>  		strne	r3, [r0, #0]
> -		mov	pc, lr
> +		ret	lr
>  
>  3:		bic	r1, r1, #3
>  		ldr	r3, [r1], #4
> @@ -46,7 +48,7 @@ ENTRY(__raw_writesl)
>  		orr	ip, ip, r3, lspush #16
>  		str	ip, [r0]
>  		bne	4b
> -		mov	pc, lr
> +		ret	lr
>  
>  5:		mov	ip, r3, lspull #8
>  		ldr	r3, [r1], #4
> @@ -54,7 +56,7 @@ ENTRY(__raw_writesl)
>  		orr	ip, ip, r3, lspush #24
>  		str	ip, [r0]
>  		bne	5b
> -		mov	pc, lr
> +		ret	lr
>  
>  6:		mov	ip, r3, lspull #24
>  		ldr	r3, [r1], #4
> @@ -62,5 +64,5 @@ ENTRY(__raw_writesl)
>  		orr	ip, ip, r3, lspush #8
>  		str	ip, [r0]
>  		bne	6b
> -		mov	pc, lr
> +		ret	lr
>  ENDPROC(__raw_writesl)
> diff --git a/arch/arm/lib32/io-writesw-armv4.S b/arch/arm/lib32/io-writesw-armv4.S
> index 5cfa74356c..717237f3cc 100644
> --- a/arch/arm/lib32/io-writesw-armv4.S
> +++ b/arch/arm/lib32/io-writesw-armv4.S
> @@ -1,12 +1,14 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
> -/* SPDX-FileCopyrightText: 1995-2000 Russell King */
> -
>  /*
> - * linux/arch/arm/lib/io-writesw-armv4.S
> + *  linux/arch/arm/lib/io-writesw-armv4.S
> + *
> + *  Copyright (C) 1995-2000 Russell King
>   */
>  #include <linux/linkage.h>
>  #include <asm/assembler.h>
>  
> +.syntax unified
> +
>  		.macro	outword, rd
>  #ifndef __ARMEB__
>  		strh	\rd, [r0]
> @@ -30,7 +32,7 @@
>  
>  ENTRY(__raw_writesw)
>  		teq	r2, #0
> -		moveq	pc, lr
> +		reteq	lr
>  		ands	r3, r1, #3
>  		bne	.Loutsw_align
>  
> @@ -60,8 +62,8 @@ ENTRY(__raw_writesw)
>  		ldr	r3, [r1], #4
>  		outword	r3
>  
> -.Lno_outsw_2:	ldrneh	r3, [r1]
> -		strneh	r3, [r0]
> +.Lno_outsw_2:	ldrhne	r3, [r1]
> +		strhne	r3, [r0]
>  
>  		ldmfd	sp!, {r4, r5, pc}
>  
> @@ -94,6 +96,6 @@ ENTRY(__raw_writesw)
>  
>  		tst	r2, #1
>  3:		movne	ip, r3, lsr #8
> -		strneh	ip, [r0]
> -		mov	pc, lr
> +		strhne	ip, [r0]
> +		ret	lr
>  ENDPROC(__raw_writesw)
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list