github.com/c12o16h1/go/src@v0.0.0-20200114212001-5a151c0f00ed/runtime/cgo/asm_mips64x.s (about) 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|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, 8(R29) will be the 18 * first arg. 19 */ 20 #ifndef GOMIPS64_softfloat 21 ADDV $(-8*23), R29 22 #else 23 ADDV $(-8*15), R29 24 #endif 25 MOVV R5, (8*1)(R29) // void* 26 MOVW R6, (8*2)(R29) // int32 27 MOVV R7, (8*3)(R29) // uintptr 28 MOVV R16, (8*4)(R29) 29 MOVV R17, (8*5)(R29) 30 MOVV R18, (8*6)(R29) 31 MOVV R19, (8*7)(R29) 32 MOVV R20, (8*8)(R29) 33 MOVV R21, (8*9)(R29) 34 MOVV R22, (8*10)(R29) 35 MOVV R23, (8*11)(R29) 36 MOVV RSB, (8*12)(R29) 37 MOVV g, (8*13)(R29) 38 MOVV R31, (8*14)(R29) 39 #ifndef GOMIPS64_softfloat 40 MOVD F24, (8*15)(R29) 41 MOVD F25, (8*16)(R29) 42 MOVD F26, (8*17)(R29) 43 MOVD F27, (8*18)(R29) 44 MOVD F28, (8*19)(R29) 45 MOVD F29, (8*20)(R29) 46 MOVD F30, (8*21)(R29) 47 MOVD F31, (8*22)(R29) 48 #endif 49 // Initialize Go ABI environment 50 // prepare SB register = PC & 0xffffffff00000000 51 BGEZAL R0, 1(PC) 52 SRLV $32, R31, RSB 53 SLLV $32, RSB 54 JAL runtimeĀ·load_g(SB) 55 JAL (R4) 56 57 MOVV (8*4)(R29), R16 58 MOVV (8*5)(R29), R17 59 MOVV (8*6)(R29), R18 60 MOVV (8*7)(R29), R19 61 MOVV (8*8)(R29), R20 62 MOVV (8*9)(R29), R21 63 MOVV (8*10)(R29), R22 64 MOVV (8*11)(R29), R23 65 MOVV (8*12)(R29), RSB 66 MOVV (8*13)(R29), g 67 MOVV (8*14)(R29), R31 68 #ifndef GOMIPS64_softfloat 69 MOVD (8*15)(R29), F24 70 MOVD (8*16)(R29), F25 71 MOVD (8*17)(R29), F26 72 MOVD (8*18)(R29), F27 73 MOVD (8*19)(R29), F28 74 MOVD (8*20)(R29), F29 75 MOVD (8*21)(R29), F30 76 MOVD (8*22)(R29), F31 77 ADDV $(8*23), R29 78 #else 79 ADDV $(8*15), R29 80 #endif 81 RET