ref: a375c9ac38e72dc5b0a6710c8da89245d154b435
parent: 57e07865953412c7cf8ae579d7a748c1540d629e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu May 9 08:40:03 EDT 2019
libc: fix return value for arm64 memset() and memove()
--- a/sys/src/ape/lib/ap/arm64/memmove.s
+++ b/sys/src/ape/lib/ap/arm64/memmove.s
@@ -8,6 +8,7 @@
BLT _backward
_forward:
+ MOV R0, R7
ADD R0, R2, R3
BIC $15, R2, R4
CBZ R4, _floop1
@@ -15,15 +16,15 @@
_floop16:
MOVP (R1)16!, R5, R6
- MOVP R5, R6, (R0)16!
- CMP R4, R0
+ MOVP R5, R6, (R7)16!
+ CMP R4, R7
BNE _floop16
_floop1:
- CMP R3, R0
+ CMP R3, R7
BEQ _done
MOVBU (R1)1!, R5
- MOVBU R5, (R0)1!
+ MOVBU R5, (R7)1!
B _floop1
_done:
--- a/sys/src/ape/lib/ap/arm64/memset.s
+++ b/sys/src/ape/lib/ap/arm64/memset.s
@@ -2,6 +2,7 @@
MOVBU c+8(FP), R1
MOVWU n+16(FP), R2
+ MOV R0, R5
ADD R0, R2, R3
BIC $15, R2, R4
CBZ R4, _loop1
@@ -12,15 +13,15 @@
ORR R1<<32, R1
_loop16:
- MOVP R1, R1, (R0)16!
- CMP R4, R0
+ MOVP R1, R1, (R5)16!
+ CMP R4, R5
BNE _loop16
_loop1:
- CMP R3, R0
+ CMP R3, R5
BEQ _done
- MOVBU R1, (R0)1!
+ MOVBU R1, (R5)1!
B _loop1
_done:
--- a/sys/src/libc/arm64/memmove.s
+++ b/sys/src/libc/arm64/memmove.s
@@ -8,6 +8,7 @@
BLT _backward
_forward:
+ MOV R0, R7
ADD R0, R2, R3
BIC $15, R2, R4
CBZ R4, _floop1
@@ -15,15 +16,15 @@
_floop16:
MOVP (R1)16!, R5, R6
- MOVP R5, R6, (R0)16!
- CMP R4, R0
+ MOVP R5, R6, (R7)16!
+ CMP R4, R7
BNE _floop16
_floop1:
- CMP R3, R0
+ CMP R3, R7
BEQ _done
MOVBU (R1)1!, R5
- MOVBU R5, (R0)1!
+ MOVBU R5, (R7)1!
B _floop1
_done:
--- a/sys/src/libc/arm64/memset.s
+++ b/sys/src/libc/arm64/memset.s
@@ -2,6 +2,7 @@
MOVBU c+8(FP), R1
MOVWU n+16(FP), R2
+ MOV R0, R5
ADD R0, R2, R3
BIC $15, R2, R4
CBZ R4, _loop1
@@ -12,15 +13,15 @@
ORR R1<<32, R1
_loop16:
- MOVP R1, R1, (R0)16!
- CMP R4, R0
+ MOVP R1, R1, (R5)16!
+ CMP R4, R5
BNE _loop16
_loop1:
- CMP R3, R0
+ CMP R3, R5
BEQ _done
- MOVBU R1, (R0)1!
+ MOVBU R1, (R5)1!
B _loop1
_done: