github.com/euank/go@v0.0.0-20160829210321-495514729181/src/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,$-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) 22 MOVV R6, (8*2)(R29) 23 MOVV R7, (8*3)(R29) 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 runtimeĀ·reginit(SB) 50 JAL runtimeĀ·load_g(SB) 51 JAL (R4) 52 53 MOVV (8*1)(R29), R5 54 MOVV (8*2)(R29), R6 55 MOVV (8*3)(R29), R7 56 MOVV (8*4)(R29), R16 57 MOVV (8*5)(R29), R17 58 MOVV (8*6)(R29), R18 59 MOVV (8*7)(R29), R19 60 MOVV (8*8)(R29), R20 61 MOVV (8*9)(R29), R21 62 MOVV (8*10)(R29), R22 63 MOVV (8*11)(R29), R23 64 MOVV (8*12)(R29), RSB 65 MOVV (8*13)(R29), g 66 MOVV (8*14)(R29), R31 67 MOVD (8*15)(R29), F24 68 MOVD (8*16)(R29), F25 69 MOVD (8*17)(R29), F26 70 MOVD (8*18)(R29), F27 71 MOVD (8*19)(R29), F28 72 MOVD (8*20)(R29), F29 73 MOVD (8*21)(R29), F30 74 MOVD (8*22)(R29), F31 75 ADDV $(8*23), R29 76 RET