changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: libc: fix return value for arm64 memset() and memove()

changeset 7224: 31f1de7ff0d4
parent 7223: f6786e3ba3da
child 7225: ff0bb3db55f7
author: cinap_lenrek@felloff.net
date: Thu, 09 May 2019 12:40:03 +0200
files: sys/src/ape/lib/ap/arm64/memmove.s sys/src/ape/lib/ap/arm64/memset.s sys/src/libc/arm64/memmove.s sys/src/libc/arm64/memset.s
description: libc: fix return value for arm64 memset() and memove()
     1.1--- a/sys/src/ape/lib/ap/arm64/memmove.s
     1.2+++ b/sys/src/ape/lib/ap/arm64/memmove.s
     1.3@@ -8,6 +8,7 @@ TEXT memmove(SB), $-4
     1.4 	BLT	_backward
     1.5 
     1.6 _forward:
     1.7+	MOV	R0, R7
     1.8 	ADD	R0, R2, R3
     1.9 	BIC	$15, R2, R4
    1.10 	CBZ	R4, _floop1
    1.11@@ -15,15 +16,15 @@ TEXT memmove(SB), $-4
    1.12 
    1.13 _floop16:
    1.14 	MOVP	(R1)16!, R5, R6
    1.15-	MOVP	R5, R6, (R0)16!
    1.16-	CMP	R4, R0
    1.17+	MOVP	R5, R6, (R7)16!
    1.18+	CMP	R4, R7
    1.19 	BNE	_floop16
    1.20 
    1.21 _floop1:
    1.22-	CMP	R3, R0
    1.23+	CMP	R3, R7
    1.24 	BEQ	_done
    1.25 	MOVBU	(R1)1!, R5
    1.26-	MOVBU	R5, (R0)1!
    1.27+	MOVBU	R5, (R7)1!
    1.28 	B	_floop1
    1.29 
    1.30 _done:
     2.1--- a/sys/src/ape/lib/ap/arm64/memset.s
     2.2+++ b/sys/src/ape/lib/ap/arm64/memset.s
     2.3@@ -2,6 +2,7 @@ TEXT memset(SB), $-4
     2.4 	MOVBU	c+8(FP), R1
     2.5 	MOVWU	n+16(FP), R2
     2.6 
     2.7+	MOV	R0, R5
     2.8 	ADD	R0, R2, R3
     2.9 	BIC	$15, R2, R4
    2.10 	CBZ	R4, _loop1
    2.11@@ -12,15 +13,15 @@ TEXT memset(SB), $-4
    2.12 	ORR	R1<<32, R1
    2.13 
    2.14 _loop16:
    2.15-	MOVP	R1, R1, (R0)16!
    2.16-	CMP	R4, R0
    2.17+	MOVP	R1, R1, (R5)16!
    2.18+	CMP	R4, R5
    2.19 	BNE	_loop16
    2.20 
    2.21 _loop1:
    2.22-	CMP	R3, R0
    2.23+	CMP	R3, R5
    2.24 	BEQ	_done
    2.25 
    2.26-	MOVBU	R1, (R0)1!
    2.27+	MOVBU	R1, (R5)1!
    2.28 	B	_loop1
    2.29 
    2.30 _done:
     3.1--- a/sys/src/libc/arm64/memmove.s
     3.2+++ b/sys/src/libc/arm64/memmove.s
     3.3@@ -8,6 +8,7 @@ TEXT memmove(SB), $-4
     3.4 	BLT	_backward
     3.5 
     3.6 _forward:
     3.7+	MOV	R0, R7
     3.8 	ADD	R0, R2, R3
     3.9 	BIC	$15, R2, R4
    3.10 	CBZ	R4, _floop1
    3.11@@ -15,15 +16,15 @@ TEXT memmove(SB), $-4
    3.12 
    3.13 _floop16:
    3.14 	MOVP	(R1)16!, R5, R6
    3.15-	MOVP	R5, R6, (R0)16!
    3.16-	CMP	R4, R0
    3.17+	MOVP	R5, R6, (R7)16!
    3.18+	CMP	R4, R7
    3.19 	BNE	_floop16
    3.20 
    3.21 _floop1:
    3.22-	CMP	R3, R0
    3.23+	CMP	R3, R7
    3.24 	BEQ	_done
    3.25 	MOVBU	(R1)1!, R5
    3.26-	MOVBU	R5, (R0)1!
    3.27+	MOVBU	R5, (R7)1!
    3.28 	B	_floop1
    3.29 
    3.30 _done:
     4.1--- a/sys/src/libc/arm64/memset.s
     4.2+++ b/sys/src/libc/arm64/memset.s
     4.3@@ -2,6 +2,7 @@ TEXT memset(SB), $-4
     4.4 	MOVBU	c+8(FP), R1
     4.5 	MOVWU	n+16(FP), R2
     4.6 
     4.7+	MOV	R0, R5
     4.8 	ADD	R0, R2, R3
     4.9 	BIC	$15, R2, R4
    4.10 	CBZ	R4, _loop1
    4.11@@ -12,15 +13,15 @@ TEXT memset(SB), $-4
    4.12 	ORR	R1<<32, R1
    4.13 
    4.14 _loop16:
    4.15-	MOVP	R1, R1, (R0)16!
    4.16-	CMP	R4, R0
    4.17+	MOVP	R1, R1, (R5)16!
    4.18+	CMP	R4, R5
    4.19 	BNE	_loop16
    4.20 
    4.21 _loop1:
    4.22-	CMP	R3, R0
    4.23+	CMP	R3, R5
    4.24 	BEQ	_done
    4.25 
    4.26-	MOVBU	R1, (R0)1!
    4.27+	MOVBU	R1, (R5)1!
    4.28 	B	_loop1
    4.29 
    4.30 _done: