Message:
Hello golang-dev@googlegroups.com (cc: dave cheney <dave@cheney.net>),
I'd like you to review this change to
https://code.google.com/p/go
Description:
runtime: Stop arm memmove corrupting its parameters
Change use of x(SP) to access the stack frame into x(R13) as SP = FP on
ARM.
Fixes issue 5925.
Please review this at https://codereview.appspot.com/11647043/
Affected files:
M src/pkg/runtime/memmove_arm.s
Index: src/pkg/runtime/memmove_arm.s
===================================================================
--- a/src/pkg/runtime/memmove_arm.s
+++ b/src/pkg/runtime/memmove_arm.s
@@ -56,6 +56,11 @@
FW3 = 4
FR3 = 8 /* shared with TE */
+// Stack frame
+ // 0(R13) saved LR
+savedts = 4 // 4(R13) temporary space for saving R(TS) or R(TE)
+savedte = 4
+
TEXT runtime·memmove(SB), 7, $4-12
_memmove:
MOVW to+0(FP), R(TS)
@@ -85,7 +90,7 @@
BNE _bunaligned
ADD $31, R(TS), R(TMP) /* do 32-byte chunks if possible */
- MOVW R(TS), savedts+4(SP)
+ MOVW R(TS), savedts(R13)
_b32loop:
CMP R(TMP), R(TE)
BLS _b4tail
@@ -95,7 +100,7 @@
B _b32loop
_b4tail: /* do remaining words if possible */
- MOVW savedts+4(SP), R(TS)
+ MOVW savedts(R13), R(TS)
ADD $3, R(TS), R(TMP)
_b4loop:
CMP R(TMP), R(TE)
@@ -130,7 +135,7 @@
BNE _funaligned
SUB $31, R(TE), R(TMP) /* do 32-byte chunks if possible */
- MOVW R(TE), savedte+4(SP)
+ MOVW R(TE), savedte(R13)
_f32loop:
CMP R(TMP), R(TS)
BHS _f4tail
@@ -140,7 +145,7 @@
B _f32loop
_f4tail:
- MOVW savedte+4(SP), R(TE)
+ MOVW savedte(R13), R(TE)
SUB $3, R(TE), R(TMP) /* do remaining words if possible */
_f4loop:
CMP R(TMP), R(TS)
@@ -182,7 +187,7 @@
BLS _b1tail
BIC $3, R(FROM) /* align source */
- MOVW R(TS), savedts+4(SP)
+ MOVW R(TS), savedts(R13)
MOVW (R(FROM)), R(BR0) /* prime first block register */
_bu16loop:
@@ -206,7 +211,7 @@
B _bu16loop
_bu1tail:
- MOVW savedts+4(SP), R(TS)
+ MOVW savedts(R13), R(TS)
ADD R(OFFSET), R(FROM)
B _b1tail
@@ -230,7 +235,7 @@
BHS _f1tail
BIC $3, R(FROM) /* align source */
- MOVW R(TE), savedte+4(SP)
+ MOVW R(TE), savedte(R13)
MOVW.P 4(R(FROM)), R(FR3) /* prime last block register, implicit write
back */
_fu16loop:
@@ -254,6 +259,6 @@
B _fu16loop
_fu1tail:
- MOVW savedte+4(SP), R(TE)
+ MOVW savedte(R13), R(TE)
SUB R(OFFSET), R(FROM)
B _f1tail
--
---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.