Commit f8fd77ba authored by Nick Craig-Wood's avatar Nick Craig-Wood Committed by Dave Cheney

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
parent 48b9be2b
......@@ -85,7 +85,7 @@ _b4aligned: /* is source now aligned? */
BNE _bunaligned
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:
CMP R(TMP), R(TE)
BLS _b4tail
......@@ -95,7 +95,7 @@ _b32loop:
B _b32loop
_b4tail: /* do remaining words if possible */
MOVW savedts+4(SP), R(TS)
MOVW savedts-4(SP), R(TS)
ADD $3, R(TS), R(TMP)
_b4loop:
CMP R(TMP), R(TE)
......@@ -130,7 +130,7 @@ _f4aligned: /* is source now aligned? */
BNE _funaligned
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:
CMP R(TMP), R(TS)
BHS _f4tail
......@@ -140,7 +140,7 @@ _f32loop:
B _f32loop
_f4tail:
MOVW savedte+4(SP), R(TE)
MOVW savedte-4(SP), R(TE)
SUB $3, R(TE), R(TMP) /* do remaining words if possible */
_f4loop:
CMP R(TMP), R(TS)
......@@ -182,7 +182,7 @@ _bunaligned:
BLS _b1tail
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 */
_bu16loop:
......@@ -206,7 +206,7 @@ _bu16loop:
B _bu16loop
_bu1tail:
MOVW savedts+4(SP), R(TS)
MOVW savedts-4(SP), R(TS)
ADD R(OFFSET), R(FROM)
B _b1tail
......@@ -230,7 +230,7 @@ _funaligned:
BHS _f1tail
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 */
_fu16loop:
......@@ -254,6 +254,6 @@ _fu16loop:
B _fu16loop
_fu1tail:
MOVW savedte+4(SP), R(TE)
MOVW savedte-4(SP), R(TE)
SUB R(OFFSET), R(FROM)
B _f1tail
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment