aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_amd64.s
diff options
context:
space:
mode:
authorRhys Hiltner <rhys@justin.tv>2021-08-13 09:01:13 -0700
committerMichael Pratt <mpratt@google.com>2021-09-27 18:58:41 +0000
commit8d09f7c5178b04bade2859d32d0710233a620d4f (patch)
tree0888aa63801bcbd512f05b898b8998e20577fc33 /src/runtime/sys_linux_amd64.s
parent5b909580849c611c633c111a15adb40c9c42ec8e (diff)
downloadgo-8d09f7c5178b04bade2859d32d0710233a620d4f.tar.xz
runtime: use per-thread profiler for SetCgoTraceback platforms
Updates #35057 Change-Id: I61d772a2cbfb27540fb70c14676c68593076ca94 Reviewed-on: https://go-review.googlesource.com/c/go/+/342054 Run-TryBot: Rhys Hiltner <rhys@justin.tv> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Trust: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/sys_linux_amd64.s')
-rw-r--r--src/runtime/sys_linux_amd64.s23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s
index 345dc90eb0..f0e58e11db 100644
--- a/src/runtime/sys_linux_amd64.s
+++ b/src/runtime/sys_linux_amd64.s
@@ -364,6 +364,23 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0
POP_REGS_HOST_TO_ABI0()
RET
+// Called using C ABI.
+TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0
+ // Transition from C ABI to Go ABI.
+ PUSH_REGS_HOST_TO_ABI0()
+
+ // Call into the Go signal handler
+ NOP SP // disable vet stack checking
+ ADJSP $24
+ MOVL DI, 0(SP) // sig
+ MOVQ SI, 8(SP) // info
+ MOVQ DX, 16(SP) // ctx
+ CALL ·sigprofNonGo(SB)
+ ADJSP $-24
+
+ POP_REGS_HOST_TO_ABI0()
+ RET
+
// Used instead of sigtramp in programs that use cgo.
// Arguments from kernel are in DI, SI, DX.
TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0
@@ -431,12 +448,12 @@ sigtrampnog:
JNZ sigtramp // Skip stack trace if already locked.
// Jump to the traceback function in runtime/cgo.
- // It will call back to sigprofNonGo, which will ignore the
- // arguments passed in registers.
+ // It will call back to sigprofNonGo, via sigprofNonGoWrapper, to convert
+ // the arguments to the Go calling convention.
// First three arguments to traceback function are in registers already.
MOVQ runtime·cgoTraceback(SB), CX
MOVQ $runtime·sigprofCallers(SB), R8
- MOVQ $runtime·sigprofNonGo(SB), R9
+ MOVQ $runtime·sigprofNonGoWrapper<>(SB), R9
MOVQ _cgo_callers(SB), AX
JMP AX