Black Lives Matter. Support the Equal Justice Initiative.

Text file src/runtime/cgo/asm_arm64.s

Documentation: runtime/cgo

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

View as plain text