Text file
src/runtime/cgo/trampoline_test_amd64.s
1 // Copyright 2026 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build goexperiment.runtimecgopurego && !msan && !tsan && (unix || windows)
6
7 #include "textflag.h"
8 #include "abi_amd64.h"
9
10 // Called on g0 with the PC buffer, its length, and the ABIInternal entry
11 // for runtime.Callers in the host's first three argument registers.
12 // Return Callers(0, buf).
13 TEXT ·trampolineCallers(SB),NOSPLIT|NOFRAME,$0-0
14 PUSH_REGS_HOST_TO_ABI0()
15 ADJSP $32 // spill space for the four ABIInternal argument registers
16 MOVQ (TLS), R14
17 XORPS X15, X15
18 XORL AX, AX
19 #ifdef GOOS_windows
20 MOVQ CX, BX
21 MOVQ DX, CX
22 MOVQ DX, DI
23 CALL R8
24 #else
25 MOVQ DI, BX
26 MOVQ SI, CX
27 MOVQ SI, DI
28 CALL DX
29 #endif
30 ADJSP $-32
31 POP_REGS_HOST_TO_ABI0()
32 RET
33
View as plain text