]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix use of STREX in various exitThread implementations
authorIan Lance Taylor <iant@golang.org>
Sat, 14 Oct 2017 15:46:50 +0000 (08:46 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 16 Oct 2017 17:15:39 +0000 (17:15 +0000)
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>
src/runtime/sys_darwin_arm.s
src/runtime/sys_freebsd_arm.s
src/runtime/sys_netbsd_arm.s
src/runtime/sys_openbsd_arm.s

index 02b8d25c39d66be48941f05d8a83f5f8088ffe37..8a7de43ea3e89e8966161b23751b52488db41cb0 100644 (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)
index 0121e623099cf2db034f7f09e4727f75338101a7..7bc4fea124b1d0fb3bbd22621124f4cfd52a2deb 100644 (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
index aa29a3155908dd6cc20d2a1836f9d0acbf26e281..b346a7f9b10a7f5ecbaf99f01f30302342ac4802 100644 (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
index c6e9e4ec17b467d0329b14f910da6e0fbaa6d224..0b77d121f4abd5f42bfabc9aaf0ac216e6b7e75a 100644 (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