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 mips mipsle
      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,$-4
     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, 4(R29) will be the
     18 	 *  first arg.
     19 	 */
     20 
     21 	// Space for 9 caller-saved GPR + LR + 6 caller-saved FPR.
     22 	// O32 ABI allows us to smash 16 bytes argument area of caller frame.
     23 	SUBU	$(4*14+8*6-16), R29
     24 	MOVW	R5, (4*1)(R29)
     25 	MOVW	R6, (4*2)(R29)
     26 	MOVW	R7, (4*3)(R29)
     27 	MOVW	R16, (4*4)(R29)
     28 	MOVW	R17, (4*5)(R29)
     29 	MOVW	R18, (4*6)(R29)
     30 	MOVW	R19, (4*7)(R29)
     31 	MOVW	R20, (4*8)(R29)
     32 	MOVW	R21, (4*9)(R29)
     33 	MOVW	R22, (4*10)(R29)
     34 	MOVW	R23, (4*11)(R29)
     35 	MOVW	g, (4*12)(R29)
     36 	MOVW	R31, (4*13)(R29)
     37 
     38 	MOVD	F20, (4*14)(R29)
     39 	MOVD	F22, (4*14+8*1)(R29)
     40 	MOVD	F24, (4*14+8*2)(R29)
     41 	MOVD	F26, (4*14+8*3)(R29)
     42 	MOVD	F28, (4*14+8*4)(R29)
     43 	MOVD	F30, (4*14+8*5)(R29)
     44 
     45 	JAL	runtimeload_g(SB)
     46 	JAL	(R4)
     47 
     48 	MOVW	(4*4)(R29), R16
     49 	MOVW	(4*5)(R29), R17
     50 	MOVW	(4*6)(R29), R18
     51 	MOVW	(4*7)(R29), R19
     52 	MOVW	(4*8)(R29), R20
     53 	MOVW	(4*9)(R29), R21
     54 	MOVW	(4*10)(R29), R22
     55 	MOVW	(4*11)(R29), R23
     56 	MOVW	(4*12)(R29), g
     57 	MOVW	(4*13)(R29), R31
     58 
     59 	MOVD	(4*14)(R29), F20
     60 	MOVD	(4*14+8*1)(R29), F22
     61 	MOVD	(4*14+8*2)(R29), F24
     62 	MOVD	(4*14+8*3)(R29), F26
     63 	MOVD	(4*14+8*4)(R29), F28
     64 	MOVD	(4*14+8*5)(R29), F30
     65 
     66 	ADDU	$(4*14+8*6-16), R29
     67 	RET
     68