aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_ppc64x.s
diff options
context:
space:
mode:
authorAndrew <andybons@golang.org>2020-08-11 11:03:03 -0400
committerAndrew Bonventre <andybons@golang.org>2020-08-11 17:05:57 +0000
commitcbc69e89b17188b3633bafa9d6e6c44f7f1a2ec0 (patch)
tree7808aa129ba880f9b8b85b5efc51d1d1f5bc7aa8 /src/runtime/sys_linux_ppc64x.s
parentc4f8cb43caf0bcd0c730d7d04a3fce129393cecc (diff)
downloadgo-cbc69e89b17188b3633bafa9d6e6c44f7f1a2ec0.tar.gz
go-cbc69e89b17188b3633bafa9d6e6c44f7f1a2ec0.zip
[release-branch.go1.15] all: merge master into release-branch.go1.15
5c7748dc9d doc/go1.15: encoding/json's CL 191783 was reverted 5ff5b3c557 doc/go1.15: remove draft notice 5ae1d62ee3 CONTRIBUTORS: update for the Go 1.15 release 7ad776dda5 doc/go1.15: document crypto/tls permanent error a93a4c1780 runtime: make nanotime1 reentrant Updates #40697 Change-Id: Ie39896ee6304544cc9e9c1938bdf176f1dcf8766 Reviewed-on: https://go-review.googlesource.com/c/go/+/247900 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_ppc64x.s')
-rw-r--r--src/runtime/sys_linux_ppc64x.s40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s
index 8629fe3233..fd69ee70a5 100644
--- a/src/runtime/sys_linux_ppc64x.s
+++ b/src/runtime/sys_linux_ppc64x.s
@@ -185,7 +185,7 @@ TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
RET
// func walltime1() (sec int64, nsec int32)
-TEXT runtime·walltime1(SB),NOSPLIT,$16
+TEXT runtime·walltime1(SB),NOSPLIT,$16-12
MOVD R1, R15 // R15 is unchanged by C code
MOVD g_m(g), R21 // R21 = m
@@ -196,6 +196,13 @@ TEXT runtime·walltime1(SB),NOSPLIT,$16
BEQ fallback
// Set vdsoPC and vdsoSP for SIGPROF traceback.
+ // Save the old values on stack and restore them on exit,
+ // so this function is reentrant.
+ MOVD m_vdsoPC(R21), R4
+ MOVD m_vdsoSP(R21), R5
+ MOVD R4, 32(R1)
+ MOVD R5, 40(R1)
+
MOVD LR, R14
MOVD R14, m_vdsoPC(R21)
MOVD R15, m_vdsoSP(R21)
@@ -214,11 +221,20 @@ noswitch:
MOVD R1, R4
BL (CTR) // Call from VDSO
MOVD $0, R0 // Restore R0
- MOVD R0, m_vdsoSP(R21) // Clear vdsoSP
MOVD 0(R1), R3 // sec
MOVD 8(R1), R5 // nsec
MOVD R15, R1 // Restore SP
+ // Restore vdsoPC, vdsoSP
+ // We don't worry about being signaled between the two stores.
+ // If we are not in a signal handler, we'll restore vdsoSP to 0,
+ // and no one will care about vdsoPC. If we are in a signal handler,
+ // we cannot receive another signal.
+ MOVD 40(R1), R6
+ MOVD R6, m_vdsoSP(R21)
+ MOVD 32(R1), R6
+ MOVD R6, m_vdsoPC(R21)
+
finish:
MOVD R3, sec+0(FP)
MOVW R5, nsec+8(FP)
@@ -232,7 +248,7 @@ fallback:
MOVD 40(R1), R5
JMP finish
-TEXT runtime·nanotime1(SB),NOSPLIT,$16
+TEXT runtime·nanotime1(SB),NOSPLIT,$16-8
MOVD $1, R3 // CLOCK_MONOTONIC
MOVD R1, R15 // R15 is unchanged by C code
@@ -243,6 +259,13 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$16
BEQ fallback
// Set vdsoPC and vdsoSP for SIGPROF traceback.
+ // Save the old values on stack and restore them on exit,
+ // so this function is reentrant.
+ MOVD m_vdsoPC(R21), R4
+ MOVD m_vdsoSP(R21), R5
+ MOVD R4, 32(R1)
+ MOVD R5, 40(R1)
+
MOVD LR, R14 // R14 is unchanged by C code
MOVD R14, m_vdsoPC(R21)
MOVD R15, m_vdsoSP(R21)
@@ -261,11 +284,20 @@ noswitch:
MOVD R1, R4
BL (CTR) // Call from VDSO
MOVD $0, R0 // Restore R0
- MOVD $0, m_vdsoSP(R21) // Clear vdsoSP
MOVD 0(R1), R3 // sec
MOVD 8(R1), R5 // nsec
MOVD R15, R1 // Restore SP
+ // Restore vdsoPC, vdsoSP
+ // We don't worry about being signaled between the two stores.
+ // If we are not in a signal handler, we'll restore vdsoSP to 0,
+ // and no one will care about vdsoPC. If we are in a signal handler,
+ // we cannot receive another signal.
+ MOVD 40(R1), R6
+ MOVD R6, m_vdsoSP(R21)
+ MOVD 32(R1), R6
+ MOVD R6, m_vdsoPC(R21)
+
finish:
// sec is in R3, nsec in R5
// return nsec in R3