github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/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 // Called by C code generated by cmd/cgo. 10 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr) 11 // Saves C callee-saved registers and calls cgocallback with three arguments. 12 // fn is the PC of a func(a unsafe.Pointer) function. 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 (R4, R5, R7), skipping R6. 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 R4, (8*1)(R29) // fn unsafe.Pointer 26 MOVV R5, (8*2)(R29) // a unsafe.Pointer 27 MOVV R7, (8*3)(R29) // ctxt 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 56 JAL runtimeĀ·cgocallback(SB) 57 58 MOVV (8*4)(R29), R16 59 MOVV (8*5)(R29), R17 60 MOVV (8*6)(R29), R18 61 MOVV (8*7)(R29), R19 62 MOVV (8*8)(R29), R20 63 MOVV (8*9)(R29), R21 64 MOVV (8*10)(R29), R22 65 MOVV (8*11)(R29), R23 66 MOVV (8*12)(R29), RSB 67 MOVV (8*13)(R29), g 68 MOVV (8*14)(R29), R31 69 #ifndef GOMIPS64_softfloat 70 MOVD (8*15)(R29), F24 71 MOVD (8*16)(R29), F25 72 MOVD (8*17)(R29), F26 73 MOVD (8*18)(R29), F27 74 MOVD (8*19)(R29), F28 75 MOVD (8*20)(R29), F29 76 MOVD (8*21)(R29), F30 77 MOVD (8*22)(R29), F31 78 ADDV $(8*23), R29 79 #else 80 ADDV $(8*15), R29 81 #endif 82 RET