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.
5 //go:build mips64 || mips64le
9 // Set the x_crosscall2_ptr C function pointer variable point to crosscall2.
10 // It's such a pointer chain: _crosscall2_ptr -> x_crosscall2_ptr -> crosscall2
11 TEXT ·set_crosscall2(SB),NOSPLIT,$0-0
12 MOVV _crosscall2_ptr(SB), R5
13 MOVV $crosscall2(SB), R6
17 // Called by C code generated by cmd/cgo.
18 // func crosscall2(fn, a unsafe.Pointer, n int32, ctxt uintptr)
19 // Saves C callee-saved registers and calls cgocallback with three arguments.
20 // fn is the PC of a func(a unsafe.Pointer) function.
21 TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
23 * We still need to save all callee save register as before, and then
24 * push 3 args for fn (R4, R5, R7), skipping R6.
25 * Also note that at procedure entry in gc world, 8(R29) will be the
28 #ifndef GOMIPS64_softfloat
33 MOVV R4, (8*1)(R29) // fn unsafe.Pointer
34 MOVV R5, (8*2)(R29) // a unsafe.Pointer
35 MOVV R7, (8*3)(R29) // ctxt uintptr
47 #ifndef GOMIPS64_softfloat
57 // Initialize Go ABI environment
58 // prepare SB register = PC & 0xffffffff00000000
62 JAL runtime·load_g(SB)
64 JAL runtime·cgocallback(SB)
77 #ifndef GOMIPS64_softfloat