aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_386.s
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-02-11 15:09:39 -0500
committerCherry Zhang <cherryyz@google.com>2020-02-13 19:49:45 +0000
commit3eab754cd061bf90ee7b540546bc0863f3ad1d85 (patch)
treeaf3dc202cb9218aae18787578b0547ea013c5c36 /src/runtime/sys_linux_386.s
parent123f7dd3e1eb90825ece57b8dde39438ca34f150 (diff)
downloadgo-3eab754cd061bf90ee7b540546bc0863f3ad1d85.tar.gz
go-3eab754cd061bf90ee7b540546bc0863f3ad1d85.zip
runtime: correct caller PC/SP offsets in walltime1/nanotime1
In walltime1/nanotime1, we save the caller's PC and SP for stack unwinding. The code does that assumed zero frame size. Now that the frame size is not zero, correct the offset. Rewrite it in a way that doesn't depend on hard-coded frame size. May fix #37127. Change-Id: I47d6d54fc3499d7d5946c3f6a2dbd24fbd679de1 Reviewed-on: https://go-review.googlesource.com/c/go/+/219118 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/sys_linux_386.s')
-rw-r--r--src/runtime/sys_linux_386.s12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s
index 8e05acf894..1b28098ad9 100644
--- a/src/runtime/sys_linux_386.s
+++ b/src/runtime/sys_linux_386.s
@@ -233,9 +233,9 @@ TEXT runtime·walltime1(SB), NOSPLIT, $0-12
MOVL g_m(AX), SI // SI unchanged by C code.
// Set vdsoPC and vdsoSP for SIGPROF traceback.
- MOVL 0(SP), DX
- MOVL DX, m_vdsoPC(SI)
- LEAL sec+0(SP), DX
+ LEAL sec+0(FP), DX
+ MOVL -4(DX), CX
+ MOVL CX, m_vdsoPC(SI)
MOVL DX, m_vdsoSP(SI)
CMPL AX, m_curg(SI) // Only switch if on curg.
@@ -296,9 +296,9 @@ TEXT runtime·nanotime1(SB), NOSPLIT, $0-8
MOVL g_m(AX), SI // SI unchanged by C code.
// Set vdsoPC and vdsoSP for SIGPROF traceback.
- MOVL 0(SP), DX
- MOVL DX, m_vdsoPC(SI)
- LEAL ret+0(SP), DX
+ LEAL ret+0(FP), DX
+ MOVL -4(DX), CX
+ MOVL CX, m_vdsoPC(SI)
MOVL DX, m_vdsoSP(SI)
CMPL AX, m_curg(SI) // Only switch if on curg.