Home | History | Annotate | Download | only in cgo
      1 // Copyright 2016 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 // +build mips64 mips64le
      6 
      7 #include "textflag.h"
      8 
      9 /*
     10  * void crosscall2(void (*fn)(void*, int32, uintptr), void*, int32, uintptr)
     11  * Save registers and call fn with two arguments.
     12  */
     13 TEXT crosscall2(SB),NOSPLIT,$-8
     14 	/*
     15 	 * We still need to save all callee save register as before, and then
     16 	 *  push 3 args for fn (R5, R6, R7).
     17 	 * Also note that at procedure entry in gc world, 8(R29) will be the
     18 	 *  first arg.
     19 	 */
     20 	ADDV	$(-8*23), R29
     21 	MOVV	R5, (8*1)(R29) // void*
     22 	MOVW	R6, (8*2)(R29) // int32
     23 	MOVV	R7, (8*3)(R29) // uintptr
     24 	MOVV	R16, (8*4)(R29)
     25 	MOVV	R17, (8*5)(R29)
     26 	MOVV	R18, (8*6)(R29)
     27 	MOVV	R19, (8*7)(R29)
     28 	MOVV	R20, (8*8)(R29)
     29 	MOVV	R21, (8*9)(R29)
     30 	MOVV	R22, (8*10)(R29)
     31 	MOVV	R23, (8*11)(R29)
     32 	MOVV	RSB, (8*12)(R29)
     33 	MOVV	g, (8*13)(R29)
     34 	MOVV	R31, (8*14)(R29)
     35 	MOVD	F24, (8*15)(R29)
     36 	MOVD	F25, (8*16)(R29)
     37 	MOVD	F26, (8*17)(R29)
     38 	MOVD	F27, (8*18)(R29)
     39 	MOVD	F28, (8*19)(R29)
     40 	MOVD	F29, (8*20)(R29)
     41 	MOVD	F30, (8*21)(R29)
     42 	MOVD	F31, (8*22)(R29)
     43 
     44 	// Initialize Go ABI environment
     45 	// prepare SB register = PC & 0xffffffff00000000
     46 	BGEZAL	R0, 1(PC)
     47 	SRLV	$32, R31, RSB
     48 	SLLV	$32, RSB
     49 	JAL	runtimeload_g(SB)
     50 	JAL	(R4)
     51 
     52 	MOVV	(8*4)(R29), R16
     53 	MOVV	(8*5)(R29), R17
     54 	MOVV	(8*6)(R29), R18
     55 	MOVV	(8*7)(R29), R19
     56 	MOVV	(8*8)(R29), R20
     57 	MOVV	(8*9)(R29), R21
     58 	MOVV	(8*10)(R29), R22
     59 	MOVV	(8*11)(R29), R23
     60 	MOVV	(8*12)(R29), RSB
     61 	MOVV	(8*13)(R29), g
     62 	MOVV	(8*14)(R29), R31
     63 	MOVD	(8*15)(R29), F24
     64 	MOVD	(8*16)(R29), F25
     65 	MOVD	(8*17)(R29), F26
     66 	MOVD	(8*18)(R29), F27
     67 	MOVD	(8*19)(R29), F28
     68 	MOVD	(8*20)(R29), F29
     69 	MOVD	(8*21)(R29), F30
     70 	MOVD	(8*22)(R29), F31
     71 	ADDV	$(8*23), R29
     72 	RET
     73