github.com/yukk001/go1.10.8@v0.0.0-20190813125351-6df2d3982e20/src/runtime/cgo/asm_arm64.s (about)

     1  // Copyright 2015 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  
     7  // Called by C code generated by cmd/cgo.
     8  // func crosscall2(fn func(a unsafe.Pointer, n int32, ctxt uintptr), a unsafe.Pointer, n int32, ctxt uintptr)
     9  // Saves C callee-saved registers and calls fn with three arguments.
    10  TEXT crosscall2(SB),NOSPLIT,$-8
    11  	/*
    12  	 * We still need to save all callee save register as before, and then
    13  	 *  push 3 args for fn (R1, R2, R3).
    14  	 * Also note that at procedure entry in gc world, 8(RSP) will be the
    15  	 *  first arg.
    16  	 * TODO(minux): use LDP/STP here if it matters.
    17  	 */
    18  	SUB	$(8*24), RSP
    19  	MOVD	R1, (8*1)(RSP)
    20  	MOVD	R2, (8*2)(RSP)
    21  	MOVD	R3, (8*3)(RSP)
    22  	MOVD	R19, (8*4)(RSP)
    23  	MOVD	R20, (8*5)(RSP)
    24  	MOVD	R21, (8*6)(RSP)
    25  	MOVD	R22, (8*7)(RSP)
    26  	MOVD	R23, (8*8)(RSP)
    27  	MOVD	R24, (8*9)(RSP)
    28  	MOVD	R25, (8*10)(RSP)
    29  	MOVD	R26, (8*11)(RSP)
    30  	MOVD	R27, (8*12)(RSP)
    31  	MOVD	g, (8*13)(RSP)
    32  	MOVD	R29, (8*14)(RSP)
    33  	MOVD	R30, (8*15)(RSP)
    34  	FMOVD	F8, (8*16)(RSP)
    35  	FMOVD	F9, (8*17)(RSP)
    36  	FMOVD	F10, (8*18)(RSP)
    37  	FMOVD	F11, (8*19)(RSP)
    38  	FMOVD	F12, (8*20)(RSP)
    39  	FMOVD	F13, (8*21)(RSP)
    40  	FMOVD	F14, (8*22)(RSP)
    41  	FMOVD	F15, (8*23)(RSP)
    42  
    43  	MOVD	R0, R19
    44  
    45  	// Initialize Go ABI environment
    46  	BL	runtimeĀ·load_g(SB)
    47  	BL	(R19)
    48  
    49  	MOVD	(8*1)(RSP), R1
    50  	MOVD	(8*2)(RSP), R2
    51  	MOVD	(8*3)(RSP), R3
    52  	MOVD	(8*4)(RSP), R19
    53  	MOVD	(8*5)(RSP), R20
    54  	MOVD	(8*6)(RSP), R21
    55  	MOVD	(8*7)(RSP), R22
    56  	MOVD	(8*8)(RSP), R23
    57  	MOVD	(8*9)(RSP), R24
    58  	MOVD	(8*10)(RSP), R25
    59  	MOVD	(8*11)(RSP), R26
    60  	MOVD	(8*12)(RSP), R27
    61  	MOVD	(8*13)(RSP), g
    62  	MOVD	(8*14)(RSP), R29
    63  	MOVD	(8*15)(RSP), R30
    64  	FMOVD	(8*16)(RSP), F8
    65  	FMOVD	(8*17)(RSP), F9
    66  	FMOVD	(8*18)(RSP), F10
    67  	FMOVD	(8*19)(RSP), F11
    68  	FMOVD	(8*20)(RSP), F12
    69  	FMOVD	(8*21)(RSP), F13
    70  	FMOVD	(8*22)(RSP), F14
    71  	FMOVD	(8*23)(RSP), F15
    72  	ADD	$(8*24), RSP
    73  	RET