Commit 5ddd3d58 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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: 's avatarAustin Clements <austin@google.com>
parent 001fe1d5
...@@ -107,10 +107,10 @@ TEXT exit1<>(SB),NOSPLIT,$0 ...@@ -107,10 +107,10 @@ TEXT exit1<>(SB),NOSPLIT,$0
TEXT runtime·exitThread(SB),NOSPLIT,$0-4 TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0 MOVW wait+0(FP), R0
// We're done using the stack. // We're done using the stack.
MOVW $0, R1 MOVW $0, R2
storeloop: storeloop:
LDREX (R0), R4 // loads R4 LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2 STREX R2, (R0), R1 // stores R2
CMP $0, R1 CMP $0, R1
BNE storeloop BNE storeloop
JMP exit1<>(SB) JMP exit1<>(SB)
......
...@@ -86,10 +86,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-8 ...@@ -86,10 +86,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-8
TEXT runtime·exitThread(SB),NOSPLIT,$0-4 TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0 MOVW wait+0(FP), R0
// We're done using the stack. // We're done using the stack.
MOVW $0, R1 MOVW $0, R2
storeloop: storeloop:
LDREX (R0), R4 // loads R4 LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2 STREX R2, (R0), R1 // stores R2
CMP $0, R1 CMP $0, R1
BNE storeloop BNE storeloop
MOVW $0, R0 // arg 1 long *state MOVW $0, R0 // arg 1 long *state
......
...@@ -22,10 +22,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-4 ...@@ -22,10 +22,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-4
TEXT runtime·exitThread(SB),NOSPLIT,$0-4 TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0 MOVW wait+0(FP), R0
// We're done using the stack. // We're done using the stack.
MOVW $0, R1 MOVW $0, R2
storeloop: storeloop:
LDREX (R0), R4 // loads R4 LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2 STREX R2, (R0), R1 // stores R2
CMP $0, R1 CMP $0, R1
BNE storeloop BNE storeloop
SWI $0xa00136 // sys__lwp_exit SWI $0xa00136 // sys__lwp_exit
......
...@@ -26,10 +26,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-4 ...@@ -26,10 +26,10 @@ TEXT runtime·exit(SB),NOSPLIT,$-4
TEXT runtime·exitThread(SB),NOSPLIT,$0-4 TEXT runtime·exitThread(SB),NOSPLIT,$0-4
MOVW wait+0(FP), R0 MOVW wait+0(FP), R0
// We're done using the stack. // We're done using the stack.
MOVW $0, R1 MOVW $0, R2
storeloop: storeloop:
LDREX (R0), R4 // loads R4 LDREX (R0), R4 // loads R4
STREX R1, (R0), R1 // stores R2 STREX R2, (R0), R1 // stores R2
CMP $0, R1 CMP $0, R1
BNE storeloop BNE storeloop
MOVW $0, R0 // arg 1 - notdead MOVW $0, R0 // arg 1 - notdead
......
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