1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:40:08 -07:00

runtime: Stop arm memmove corrupting its parameters

Change use of x+(SP) to access the stack frame into x-(SP)

Fixes #5925.

R=golang-dev, bradfitz, dave, remyoudompheng, nick, rsc
CC=dave cheney <dave, golang-dev
https://golang.org/cl/11647043
This commit is contained in:
Nick Craig-Wood 2013-07-23 09:29:25 +10:00 committed by Dave Cheney
parent 48b9be2b19
commit f8fd77baa9

View File

@ -85,7 +85,7 @@ _b4aligned: /* is source now aligned? */
BNE _bunaligned BNE _bunaligned
ADD $31, R(TS), R(TMP) /* do 32-byte chunks if possible */ ADD $31, R(TS), R(TMP) /* do 32-byte chunks if possible */
MOVW R(TS), savedts+4(SP) MOVW R(TS), savedts-4(SP)
_b32loop: _b32loop:
CMP R(TMP), R(TE) CMP R(TMP), R(TE)
BLS _b4tail BLS _b4tail
@ -95,7 +95,7 @@ _b32loop:
B _b32loop B _b32loop
_b4tail: /* do remaining words if possible */ _b4tail: /* do remaining words if possible */
MOVW savedts+4(SP), R(TS) MOVW savedts-4(SP), R(TS)
ADD $3, R(TS), R(TMP) ADD $3, R(TS), R(TMP)
_b4loop: _b4loop:
CMP R(TMP), R(TE) CMP R(TMP), R(TE)
@ -130,7 +130,7 @@ _f4aligned: /* is source now aligned? */
BNE _funaligned BNE _funaligned
SUB $31, R(TE), R(TMP) /* do 32-byte chunks if possible */ SUB $31, R(TE), R(TMP) /* do 32-byte chunks if possible */
MOVW R(TE), savedte+4(SP) MOVW R(TE), savedte-4(SP)
_f32loop: _f32loop:
CMP R(TMP), R(TS) CMP R(TMP), R(TS)
BHS _f4tail BHS _f4tail
@ -140,7 +140,7 @@ _f32loop:
B _f32loop B _f32loop
_f4tail: _f4tail:
MOVW savedte+4(SP), R(TE) MOVW savedte-4(SP), R(TE)
SUB $3, R(TE), R(TMP) /* do remaining words if possible */ SUB $3, R(TE), R(TMP) /* do remaining words if possible */
_f4loop: _f4loop:
CMP R(TMP), R(TS) CMP R(TMP), R(TS)
@ -182,7 +182,7 @@ _bunaligned:
BLS _b1tail BLS _b1tail
BIC $3, R(FROM) /* align source */ BIC $3, R(FROM) /* align source */
MOVW R(TS), savedts+4(SP) MOVW R(TS), savedts-4(SP)
MOVW (R(FROM)), R(BR0) /* prime first block register */ MOVW (R(FROM)), R(BR0) /* prime first block register */
_bu16loop: _bu16loop:
@ -206,7 +206,7 @@ _bu16loop:
B _bu16loop B _bu16loop
_bu1tail: _bu1tail:
MOVW savedts+4(SP), R(TS) MOVW savedts-4(SP), R(TS)
ADD R(OFFSET), R(FROM) ADD R(OFFSET), R(FROM)
B _b1tail B _b1tail
@ -230,7 +230,7 @@ _funaligned:
BHS _f1tail BHS _f1tail
BIC $3, R(FROM) /* align source */ BIC $3, R(FROM) /* align source */
MOVW R(TE), savedte+4(SP) MOVW R(TE), savedte-4(SP)
MOVW.P 4(R(FROM)), R(FR3) /* prime last block register, implicit write back */ MOVW.P 4(R(FROM)), R(FR3) /* prime last block register, implicit write back */
_fu16loop: _fu16loop:
@ -254,6 +254,6 @@ _fu16loop:
B _fu16loop B _fu16loop
_fu1tail: _fu1tail:
MOVW savedte+4(SP), R(TE) MOVW savedte-4(SP), R(TE)
SUB R(OFFSET), R(FROM) SUB R(OFFSET), R(FROM)
B _f1tail B _f1tail