Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * arch/alpha/lib/ev67-strlen.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * 21264 version by Rick Gorton <rick.gorton@alpha-processor.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Finds length of a 0-terminated string.  Optimized for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Alpha architecture:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *	- memory accessed as aligned quadwords only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *	- uses bcmpge to compare 8 bytes in parallel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * Much of the information about 21264 scheduling/coding comes from:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  *	Compiler Writer's Guide for the Alpha 21264
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  *	abbreviated as 'CWG' in other comments here
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  *	ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * Scheduling notation:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  *	E	- either cluster
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  *	U	- upper subcluster; U0 - subcluster U0; U1 - subcluster U1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  *	L	- lower subcluster; L0 - subcluster L0; L1 - subcluster L1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	.set noreorder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	.set noat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	.globl	strlen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	.ent	strlen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	.align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) strlen:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	ldq_u	$1, 0($16)	# L : load first quadword ($16  may be misaligned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	lda	$2, -1($31)	# E :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	insqh	$2, $16, $2	# U :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	andnot	$16, 7, $0	# E :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	or	$2, $1, $1	# E :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	cmpbge	$31, $1, $2	# E : $2  <- bitmask: bit i == 1 <==> i-th byte == 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	nop			# E :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	bne	$2, $found	# U :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) $loop:	ldq	$1, 8($0)	# L :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	addq	$0, 8, $0	# E : addr += 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	cmpbge	$31, $1, $2	# E :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	beq	$2, $loop	# U :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) $found:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	cttz	$2, $3		# U0 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	addq	$0, $3, $0	# E :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	subq	$0, $16, $0	# E :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	ret	$31, ($26)	# L0 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	.end	strlen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	EXPORT_SYMBOL(strlen)