1
0
mirror of https://github.com/golang/go synced 2024-11-19 12:04:43 -07:00

runtime: fix use of STREX in various exitThread implementations

STREX does not permit using the same register for the value to store
and the place where the result is returned. Also the code was wrong
anyhow if the first store failed.

Fixes #22248

Change-Id: I96013497410058514ffcb771c76c86faa1ec559b
Reviewed-on: https://go-review.googlesource.com/70911
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Ian Lance Taylor 2017-10-14 08:46:50 -07:00
parent 001fe1d57a
commit 5ddd3d588c
4 changed files with 8 additions and 8 deletions

View File

@ -107,10 +107,10 @@ TEXT exit1<>(SB),NOSPLIT,$0
TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0
// We're done using the stack.
MOVW $0, R1
MOVW $0, R2
storeloop:
LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2
STREX R2, (R0), R1 // stores R2
CMP $0, R1
BNE storeloop
JMP exit1<>(SB)

View File

@ -86,10 +86,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-8
TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0
// We're done using the stack.
MOVW $0, R1
MOVW $0, R2
storeloop:
LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2
STREX R2, (R0), R1 // stores R2
CMP $0, R1
BNE storeloop
MOVW $0, R0 // arg 1 long *state

View File

@ -22,10 +22,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-4
TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0
// We're done using the stack.
MOVW $0, R1
MOVW $0, R2
storeloop:
LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2
STREX R2, (R0), R1 // stores R2
CMP $0, R1
BNE storeloop
SWI $0xa00136 // sys__lwp_exit

View File

@ -26,10 +26,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-4
TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0
// We're done using the stack.
MOVW $0, R1
MOVW $0, R2
storeloop:
LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2
STREX R2, (R0), R1 // stores R2
CMP $0, R1
BNE storeloop
MOVW $0, R0 // arg 1 - notdead