...

Text file src/runtime/cgo/asm_amd64.s

Documentation: runtime/cgo

		 1// Copyright 2009 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#include "textflag.h"
		 6#include "abi_amd64.h"
		 7
		 8// Called by C code generated by cmd/cgo.
		 9// func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
		10// Saves C callee-saved registers and calls cgocallback with three arguments.
		11// fn is the PC of a func(a unsafe.Pointer) function.
		12// This signature is known to SWIG, so we can't change it.
		13TEXT crosscall2(SB),NOSPLIT,$0-0
		14	PUSH_REGS_HOST_TO_ABI0()
		15
		16	// Make room for arguments to cgocallback.
		17	ADJSP	$0x18
		18#ifndef GOOS_windows
		19	MOVQ	DI, 0x0(SP)	/* fn */
		20	MOVQ	SI, 0x8(SP)	/* arg */
		21	// Skip n in DX.
		22	MOVQ	CX, 0x10(SP)	/* ctxt */
		23#else
		24	MOVQ	CX, 0x0(SP)	/* fn */
		25	MOVQ	DX, 0x8(SP)	/* arg */
		26	// Skip n in R8.
		27	MOVQ	R9, 0x10(SP)	/* ctxt */
		28#endif
		29
		30	CALL	runtime·cgocallback(SB)
		31
		32	ADJSP	$-0x18
		33	POP_REGS_HOST_TO_ABI0()
		34	RET

View as plain text