...

Text file src/runtime/cgo/asm_mipsx.s

     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|NOFRAME,$0
    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	#ifndef GOMIPS_softfloat
    24		SUBU	$(4*14+8*6-16), R29
    25	#else
    26		SUBU	$(4*14-16), R29	// For soft-float, no FPR.
    27	#endif
    28		MOVW	R5, (4*1)(R29)
    29		MOVW	R6, (4*2)(R29)
    30		MOVW	R7, (4*3)(R29)
    31		MOVW	R16, (4*4)(R29)
    32		MOVW	R17, (4*5)(R29)
    33		MOVW	R18, (4*6)(R29)
    34		MOVW	R19, (4*7)(R29)
    35		MOVW	R20, (4*8)(R29)
    36		MOVW	R21, (4*9)(R29)
    37		MOVW	R22, (4*10)(R29)
    38		MOVW	R23, (4*11)(R29)
    39		MOVW	g, (4*12)(R29)
    40		MOVW	R31, (4*13)(R29)
    41	#ifndef GOMIPS_softfloat
    42		MOVD	F20, (4*14)(R29)
    43		MOVD	F22, (4*14+8*1)(R29)
    44		MOVD	F24, (4*14+8*2)(R29)
    45		MOVD	F26, (4*14+8*3)(R29)
    46		MOVD	F28, (4*14+8*4)(R29)
    47		MOVD	F30, (4*14+8*5)(R29)
    48	#endif
    49		JAL	runtimeĀ·load_g(SB)
    50		JAL	(R4)
    51	
    52		MOVW	(4*4)(R29), R16
    53		MOVW	(4*5)(R29), R17
    54		MOVW	(4*6)(R29), R18
    55		MOVW	(4*7)(R29), R19
    56		MOVW	(4*8)(R29), R20
    57		MOVW	(4*9)(R29), R21
    58		MOVW	(4*10)(R29), R22
    59		MOVW	(4*11)(R29), R23
    60		MOVW	(4*12)(R29), g
    61		MOVW	(4*13)(R29), R31
    62	#ifndef GOMIPS_softfloat
    63		MOVD	(4*14)(R29), F20
    64		MOVD	(4*14+8*1)(R29), F22
    65		MOVD	(4*14+8*2)(R29), F24
    66		MOVD	(4*14+8*3)(R29), F26
    67		MOVD	(4*14+8*4)(R29), F28
    68		MOVD	(4*14+8*5)(R29), F30
    69	
    70		ADDU	$(4*14+8*6-16), R29
    71	#else
    72		ADDU	$(4*14-16), R29
    73	#endif
    74		RET

View as plain text